mnekkach
mnekkach

Reputation: 343

Fortran Error compilation when I would like to change work directory

In a Fortran subroutine I would like to change the work directory and I use

CHDIR("/new/work/directory")

but I have a compilation error

error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ( % [ . = =>
       [cc]       CHDIR("/new/work/directory")
       [cc] ------------------------^

I use CHDIR in other part of my code and I have not problems.

Someone can help me.

Upvotes: 0

Views: 82

Answers (2)

mnekkach
mnekkach

Reputation: 343

I solved my issue with code below

INTEGER I

I = CHDIR("/new/work/directory")

Upvotes: 0

CHDIR does not exist in standard Fortran.

Compilers may provided as an extension either as a subroutine:

call CHDIR(...)

(note the call), or as a function

IER = CHDIR(...)

Consult your compiler's manual for the right form. E.g., the GCC manual. You may also need to use some module.

You cannot use it as a statement without anything else.

Upvotes: 3

Related Questions