Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FCREAATE() and error #5 (access denied)

Status
Not open for further replies.

mmerlinn

Programmer
May 20, 2005
749
US
I am having a vexing problem with FCREATE(). Sometimes it works as expected and other times FERROR() returns error code 5 (access denied). I have been unable to find any documentation on what causes this error code. Can anyone help?

I am using FCREATE() in GENPAGE().

When I call GENPAGE() from PROGRAM_ONE everything works as expected.

When I call GENPAGE() from PROGRAM_TWO I get the access denied error code.

Both PROGRAM_ONE and PROGRAM_TWO are called from the same DO CASE structure in MAIN.PRG, so the problem must be somewhere in PROGRAM_TWO. However, since I don't have the foggiest idea what I am looking for, I can't find the problem.

Any help would greatly be appreciated.e


mmerlinn

"Political correctness is the BADGE of a COWARD!"

 
That error is because you're trying to fcreate a file that is already open.

You must make sure that you do an FCLOSE() on that file before you try to do subsequent FCREATE() on the same file.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
I am doing a CLOSE ALL before trying to FCREATE() the file. Shouldn't that close all handles that are open?

o


mmerlinn

"Political correctness is the BADGE of a COWARD!"

 
I double checked to see if any files were open. When I did a DISPLAY STATUS immediately before FCREATE(), there were no user files open. Based on that, there is some other unknown problem.


mmerlinn

"Political correctness is the BADGE of a COWARD!"

 
mmerlinn,
you are sure same file name with "access denied" ?
May be other process (antivir, ..) check at the same time your file ?(try add waiting cca 1 sec between one and two)
Try add your source code ...
Tesar
 
Shouldn't that close all handles that are open?
As long as you haven't lost the file handle associated with it. A couple of examples that come to mind are, say you are running a .prg, do an FOPEN(), and the .prg ends. That handle will get lost. Or you call a function or procedure which opens a file. You return from that procedure and the handle goes out of scope.
Another issue could be access rights for the drive or folder.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Found the problem. Was trying to FCREATE() to a non-existent directory.

Thanks for the help.






mmerlinn

"Political correctness is the BADGE of a COWARD!"

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top