Passing Variables with the SYSTEM Call

Last reviewed: March 10, 1997
Article ID: Q57571
4.10 5.00 5.10 1.00 1.00a | 4.10 5.00 5.10 | 1.00 4.00
MS-DOS                    | OS/2           | WINDOWS NT
kbprg kbocde

The information in this article applies to:

  • Microsoft FORTRAN for MS-DOS, versions 4.1, 5.0, and 5.1
  • Microsoft FORTRAN for OS/2, versions 4.1, 5.0, and 5.1
  • Microsoft FORTRAN PowerStation for MS-DOS, versions 1.0 and 1.0a
  • Microsoft FORTRAN PowerStation 32 for Windows NT, version 1.0 and 4.0

SUMMARY

The C Run-time function, SYSTEM, is available within the FORTRAN Run Time Library. It is possible to pass a variable argument within that function call. The variable can also be a concatenated variable. Below is an example demonstrating this feature.

NOTE: SYSTEM is a C function within the FORTRAN Library. Any limitation or characteristics that are encountered are those of the C convention and not of FORTRAN (for example, null terminated strings).

MORE INFORMATION

Sample Code

c...This program will demonstrate the use of a concatenated c...variable argument for the SYSTEM function call. It has c...the same effect as typing DIR *.FOR at the MS-DOS prompt.

c..Interface statement

      interface to integer*2 function system[c]
     +(string[reference])
      character*1 string
      end

c..Variable set up and function call

      integer*2 system
      character*4 str
      character*5 ing
      character*9 all
      str='dir'
      ing='*.for'c   ! c treats this as a null terminated C string
      all=str//ing   ! Concatenate the string as 'dir *.for'
      i=system(all)  ! Pass a variable to SYSTEM
      end


Additional reference words: kbinf 1.00 4.00 4.10 5.00 5.10
KBCategory: kbprg kbocde
KBSubcategory: FORTLngIss

Keywords : FORTLngIss kbcode kbprg
Version : 4.10 5.00 5.10 1.00 1.00a | 4.10
Platform : MS-DOS NT OS/2 WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 10, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.