1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

CALL SYSTEM from Fortran

Discussion in 'Support' started by oph, May 23, 2011.

  1. oph

    oph

    Joined:
    Jun 28, 2008
    Messages:
    25
    Likes Received:
    0
    I found a problem with CALL SYSTEM from Fortran under Windows 7 64 bits.

    The following small program:

    call system('dir')
    stop
    end

    shows the dir.

    Under Windows XP 32 bits the directory shown is the current working directory (it is correct).

    Under Windows 7 64 bits, the directory shown is the root directory n(it is a problem).

    The same program shows the current working directory (the correct) when I run it from cmd.

    Similar problems with other commands as delete, copy, etc.


    Regards.
     
  2. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    From: oph
    | I found a problem with CALL SYSTEM from Fortran under Windows 7 64
    | bits.
    |
    | The following small program:
    |
    | call system('dir')
    | stop
    | end
    |
    | shows the dir.
    |
    | Under Windows XP 32 bits the directory shown is the current working
    | directory (it is correct).
    |
    | Under Windows 7 64 bits, the directory shown is the root directory
    | n(it is a problem).
    |
    | The same program shows the current working directory (the correct)
    | when I run it from cmd.
    |
    | Similar problems with other commands as delete, copy, etc.

    I suspect that your TCSTART.BTM on Win7 contains a command to change directory, while the one on your WinXP system does not.
    --
    HTH, Steve
     
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,883
    Likes Received:
    29
    The last I knew (a long time ago) "system" (in "C") used CMD.EXE regardless of
    %COMSPEC. Has that changed? Is it different with Fortran?

    On Mon, 23 May 2011 09:19:19 -0400, Steve Fabian <> wrote:

    |From: oph
    || I found a problem with CALL SYSTEM from Fortran under Windows 7 64
    || bits.
    ||
    || The following small program:
    ||
    || call system('dir')
    || stop
    || end
    ||
    || shows the dir.
    ||
    || Under Windows XP 32 bits the directory shown is the current working
    || directory (it is correct).
    ||
    || Under Windows 7 64 bits, the directory shown is the root directory
    || n(it is a problem).
    ||
    || The same program shows the current working directory (the correct)
    || when I run it from cmd.
    ||
    || Similar problems with other commands as delete, copy, etc.
    |
    |I suspect that your TCSTART.BTM on Win7 contains a command to change directory, while the one on your WinXP system does not.
     
  4. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    From: vefatica
    | The last I knew (a long time ago) "system" (in "C") used CMD.EXE
    | regardless of
    | %COMSPEC. Has that changed? Is it different with Fortran?

    That would depend on the RTL used when linking. With an MS-supplied RTL I'd not be surprised the above to be true.
    --
    Steve
     
  5. oph

    oph

    Joined:
    Jun 28, 2008
    Messages:
    25
    Likes Received:
    0
    Yes, it was the cause of the problem.

    Thank you!

    Regards
     

Share This Page