Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

More about GETCWD problem

WSinc
New Contributor I
769 Views
I know this was discussed before, but I still can't make it work consistently.
Here is a test case illustrating the problem.

Interestingly enough, the use of GETFULLPATH does return the current working
directory, which includes the file name. But GETCWD does not return anything.
[bash]    PROGRAM TEST_GETCWD
use ifport
implicit NONE
character*80 cwd,cwd2
integer(4) istat,istat3
logical(4) istat2
istat=getcwd(cwd)
print *,"istat=",istat
print *,"cwd=",cwd
istat2=changedirqq("C:\")
print *,"istat2=",istat2
istat3=getcwd(cwd2)
print *,"istat3=",istat3
print *,"cwd2=",cwd2
pause "exiting"
end program
[/bash]
Why would I get a status of 34 on the first call?
Generally the first call should return the current
working directory where execution is started from (?)
0 Kudos
4 Replies
Steven_L_Intel1
Employee
769 Views
I don't get a status of 34, but if the default path is longer than 80 characters, you might get an error.

Don't you mean to use cwd2 in line 12?
0 Kudos
WSinc
New Contributor I
769 Views
You're right, I did mean to use that. When I fix it, I do get the correct answer.
As far as the first call, I will lengthen the CHARACTER variable, see what happens.

Where would I find out what that error #34 actually means?
Is that the same as the I/O errors from OPEN, CLOSE, READ, etc?

Thanks; Bill S.
0 Kudos
Steven_L_Intel1
Employee
769 Views
It's a "C errno" value. You can get a list here - look at the rightmost column.
0 Kudos
WSinc
New Contributor I
769 Views
Very helpful, thanks -

I never would have found that on my own.....
0 Kudos
Reply