How to know whether a text file is opened - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to know whether a text file is opened

blackr12345blackr12345 Posts: 4Member
Hi there, I have a very urgent problem.

So I'm writing a program with text files.
The text file, "account", will need to be accessed and edited (rewrite, reset, append).

So if I have left the file opened before I enter the Edit Procedure of my program, there would be an error. (I know this but I need to prevent from this)

So if I don't enter the program, resetting and reading the file do not make any error. (of course)

Now I need to be noticed before I enter the procedure. I want to warn the user to stop/quit the "account" text file so that my program could successfully edit the file in the Edit Procedure.

I think I need a command that could "distinguish" or give me an error code (like IOresult) so I could fix this fatal error.

Any ideas would be appreciated. Thank you.
Sign In or Register to comment.