- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following open statement is not working in Visual Fort ran 6.0
and Windows 2000.
open (unit=35,file=cc:cashflow.cfi',
* status=old',action=read',iostat=is)
I physically check the file. It does exist and I have full access of it. The same statement in Fort ran 4.0 and Win 95
works OK (even though it sounds working in some machines but not others).
Anybody has idea what is the problem and how to fix
it.
Thanks.
Roger Lei
and Windows 2000.
open (unit=35,file=cc:cashflow.cfi',
* status=old',action=read',iostat=is)
I physically check the file. It does exist and I have full access of it. The same statement in Fort ran 4.0 and Win 95
works OK (even though it sounds working in some machines but not others).
Anybody has idea what is the problem and how to fix
it.
Thanks.
Roger Lei
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What is the value of the IOSTAT variable after the OPEN fails? What error is displayed if you leave off IOSTAT=?
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is not necessarily helpful on this particular one, but because there are a lot of problems with opening files, here is a useful little utility for checking on the existence of a file. I inherited it many years ago and it is by now a well-used member of my user utilities library. Its name is easier for bears to remember than the single line of code that it contains, is an alternative to putting STATUS = ?OLD? in the OPEN statement and is in a form that keeps the code flowing, eg:
IF (FIND_FILE(INPUT_DATA_FILE)) THEN
OPEN(UNIT=1, FILE=INPUT_DATA_FILE, ACTION=?READ?)
ELSE
WRITE(*,*) ?INPUT DATA FILE NOT FOUND?
PAUSE
STOP
END IF
Bear of little brain
IF (FIND_FILE(INPUT_DATA_FILE)) THEN
OPEN(UNIT=1, FILE=INPUT_DATA_FILE, ACTION=?READ?)
ELSE
WRITE(*,*) ?INPUT DATA FILE NOT FOUND?
PAUSE
STOP
END IF
LOGICAL*1 FUNCTION FIND_FILE(FILE1) C C THIS FUNCTION RETURNS TRUE IF "FILE1" EXISTS, OTHERWISE FALSE. C ARG: CHARACTER*(*) FILE1 - NAME OF FILE C IMPLICIT NONE CHARACTER* (*) FILE1 C INQUIRE (FILE=FILE1, EXIST=FIND_FILE) END
Bear of little brain
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page