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

GETFILEINFOQQ, Checking for read-only

Michael8
Beginner
1,168 Views
Hello:

I have recently upgraded my compilerto version11.1.065, and I have a question about checking if a file is read-only. I am using GETFILEINFOQQ function, and checking the FILE$READONLY bit againstinfo%permit. It is returning a value of 0, indicating that the file is not read-only. Indeed, if I check the properties of the file, I see that the"Read-only" box is not checked.

However, the file resides on a server, and I only have read-access to that directory (and its contents) of the server. So, even though the file's propertiesdo not indicate read-only, for me the file is read-only. In this case, whatshould be the proper return value from GETFILEINFOQQ? Like I mentioned, it is returning thatthe fileis not read-only, but has that possibly changed in the last few versions of IVF? I was running 11.1.038, and I don't think I ran into this problem (though, perhaps I never checked carefully enough).

Thanks.
Michael
0 Kudos
4 Replies
Wendy_Doerner__Intel
Valued Contributor I
1,168 Views
Michael,

The documentation does say it only checks the permissions on the file, not the path of the file. I am curious of the behavior has changed though between releases (I am not seeing anything on my side that would suggest it would). Do you have the test case that of your code that does the call to GETFILEINFOQQ? I would like to reproduce it here and test with 11.1.038.

Thanks,

------

Wendy

Attaching or including files in a post

0 Kudos
DavidWhite
Valued Contributor II
1,168 Views
Michael,

One way to check whether the folder is read only would be to attempt to open a temporary file with NEW, READONLY attributes, and checkingIOSTAT for the open.

David
0 Kudos
Michael8
Beginner
1,168 Views
Hello:

Thank you for your replies.

Wendy: I have checked with a coworker that has 11.1.038 and I guess I was mis-remembering. It does look likeit's always checkingfile properties for the read-only flag. I am looking for a way to check if the file is read-only for me specifically.

David: Thanks - interesting suggestion. I'll have to give that a try. What is the reasoning behind needing the READONLY attribute to test the directory?

Thanks.
Michael
0 Kudos
DavidWhite
Valued Contributor II
1,168 Views
Michael,

Sorry, I should have had WRITEONLY - you want to force the file open so that your app has exclusive access to the file. I guess READWRITE would have the same effect.

Regards,

David
0 Kudos
Reply