Sign in to follow this  
Followers 0
Mojo

FileOpen and FileClose

4 posts in this topic

Hi guys,

I know it's probably a pretty stupid question but I just wanna make sure I get this right.

My question is: If I do a FileOpen and the function returns -1, do I still have to FileClose() it again or not? What is your recommended way of doing this?

I'm asking, because I think it doesn't necessarily mean that the file could not be opened, instead it could maybe have opened the file but wasn't able to get write access, or something like that. So then it might have an open handle to the file?!

Sorry for my not so perfect english ;-)


You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Doh - what MHz said makes much more sense - naturally :-)

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

My question is: If I do a FileOpen and the function returns -1, do I still have to FileClose() it again or not? What is your recommended way of doing this?

I am not sure what the "again" is for but if FileOpen returns -1, then you have no handle to use FileClose with.

I'm asking, because I think it doesn't necessarily mean that the file could not be opened, instead it could maybe have opened the file but wasn't able to get write access, or something like that. So then it might have an open handle to the file?!

FileOpen failed if -1 was returned. If the file is already open, then not much you can do if you do not have a handle to the open file. The only thing you have is a variable that contains the value of -1 and using FileClose on that variable achieves nothing AFAIK.

There is no maybe about it, either you get the handle to use FileClose on it or you get a variable with a value of -1.

:)

Share this post


Link to post
Share on other sites

I am not sure what the "again" is for but if FileOpen returns -1, then you have no handle to use FileClose with.

FileOpen failed if -1 was returned. If the file is already open, then not much you can do if you do not have a handle to the open file. The only thing you have is a variable that contains the value of -1 and using FileClose on that variable achieves nothing AFAIK.

There is no maybe about it, either you get the handle to use FileClose on it or you get a variable with a value of -1.

:)

True true, thanks for your answer.

btw. the "again" was like: "You open a file, later you close it again" - Maybe that's a German-English / English-German issue.


You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0