forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with the Open Statement
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
KL
Guest





PostPosted: Wed Sep 05, 2007 5:39 pm    Post subject: Problem with OPEN Reply with quote

Andy,

I misunderstood you, sorry!

I just repeated the test and got the same (wrong) result as before. Introducing iostat does not change the result. In my case, the error code is 0. How can this be?

I am using Windows XP but I do not believe, that such details are the reason.

Best regards,

Klaus

PS. I took the code from the forum, so I must have used the identical form as you.
Back to top
KL
Guest





PostPosted: Wed Sep 05, 2007 6:30 pm    Post subject: Problems with OPEN Reply with quote

Andy, with the option status = 'new' the answer is correct, so I guess that something is strange with the option status = 'unknown'.

Klaus
Back to top
KL
Guest





PostPosted: Thu Sep 06, 2007 7:47 am    Post subject: Problem with OPEN Reply with quote

Dear Andy,
I suggest that we try to find out why the program gives different results
outside the forum. First we should exclude simple errors:
a) the directory 'd:\ftn95\tests\test41' must exist or the program must be modified.
b) the compiler options should be identical. I have noticed several times
that errors occur only for a specific option.

Klaus

PS When I tried to send this message directly to you I received an error message. Actually, I received this message yesterday more than once!
Back to top
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7925
Location: Salford, UK

PostPosted: Thu Sep 06, 2007 7:56 am    Post subject: Reply with quote

Klaus

Has this problem been resolved now?

If not can, you summarise the problem and I will try to find time to look at it on Friday.
Back to top
View user's profile Send private message AIM Address
KL
Guest





PostPosted: Thu Sep 06, 2007 5:37 pm    Post subject: Problems with OPEN Reply with quote

Dear Paul,

the status is as follows:

I have noticed an unexpected behaviour in the open statement and in the function fexists@:

1. Open statement: when I open a file in an existing directory, but I misspell the directory name and type a slash instead of a back-slash, the OPEN statement does not lead to an error. See the program which I have posted as the first one. Later on I found that the option status = 'new' gives in the test program (but not always!) the correct result, whereas status = 'unknown' failed. I used the OPEN statement to detect whether a directory exists.
2. "Sparge" recommended to use fexists@ instead of the open statement for finding out whether a directory exists. He did this applying fexist@ to a directory (which is actually not foreseen), you recommended to append the wild card '\*.*'. I have tried this and found that appending a wild card leads to an error message. See my second posted file.

May be that I have not applied fexists@ correctly. But I do not see that I am not using OPEN correctly. A look to the details of OPEN and fexists@ seems to be worthwhile.

Therefore, it would be nice if you could have another look to the problem. What did you mean when you indicated that "/" and "\" are sometimes used interchangably?

I consider this problem as not significant, nevertheless I would like to understand what happens.

Best regards

Klaus
Back to top
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7925
Location: Salford, UK

PostPosted: Fri Sep 07, 2007 12:40 pm    Post subject: Reply with quote

Klaus

Here is my test program (C:\ftn95 already exists).

Code:

integer io
logical L,fexists@
io = 1000
open( unit = 10, iostat = io, file = 'c:/ftn95\test.f90')
write(unit = 10, iostat = io, fmt = *) 'Testing'
close(10)                   !Creates and writes to c:\ftn95\test.f90
L=fexists@("c:/ftn95\", io) !gives TRUE
L=fexists@("c:\ftn95\", io) !gives TRUE
end


The file test.f90 is created in the existing folder.
You are allowed to use "/" in place of "\". Both are accepted in this context.

When I use the Microsoft routine PathFileExists in a C program I set

Code:

  BOOL exist = PathFileExists("c:/ftn95");


and the result is TRUE.

Thus there are some FTN95 routines and some Microsoft functions that allow you to use "/" in place of "\" in a path.
Back to top
View user's profile Send private message AIM Address
KL
Guest





PostPosted: Mon Sep 10, 2007 9:46 am    Post subject: Problems with OPEN Reply with quote

Dear Paul,

thank you very much for your help. I could confirm your results but I will not continue in this direction. First, when I pass the misspelled directory name (slash instead of back-slash) as input path to "get_filtered_file@", this directory is not accepted. This is sometimes difficult to see since get_filtered_file@ stores a previous correct directory.

Secondly, I have severe difficulties in understanding fexists@, especially
I do not really understand the text. At least, it does not say that I can use fexists@ for the check of directories ("To search for a file with a given path name or wildcard"). When I append "\*.*" to a directory name (which you suggested in one of your mails), I get the error message 123. However, I must admit that I may have made another mistake.

Best regards and many thanks again
Klaus
Back to top
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group