Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is the file in use?
Message
From
25/01/2007 17:05:29
 
 
To
25/01/2007 16:51:00
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01189394
Message ID:
01189397
Views:
6
This is from the help entry for FOPEN():
IF FILE('errors.txt')  && Does file exist? 
   gnErrFile = FOPEN('errors.txt',12)  && If so, open read-write
ELSE
   gnErrFile = FCREATE('errors.txt')  && If not, create it
ENDIF
IF gnErrFile < 0  && Check for error opening file
   WAIT 'Cannot open or create output file' WINDOW NOWAIT
ELSE  && If no error, write to file
   =FWRITE(gnErrFile, 'Error information to be written here')
ENDIF
=FCLOSE(gnErrFile)  && Close file
MODIFY FILE errors.txt NOWAIT  && Open file in edit window 
This could be slightly modified to give you what you're looking for.

>I have a table with file names in in.
>
>Is there a way to know if a file is opened?
>
>Will I have to use fclose or fcreate?
>
>What I'm hoping for (solution) is something like the following
>
>
>If TheFileIsOpen( lcNameOfTheFile)
>   .
>   .
>   .
>else
>   .
>   .
>   .
>endif
>
Wine is sunlight, held together by water - Galileo Galilei
Un jour sans vin est comme un jour sans soleil - Louis Pasteur
Water separates the people of the world; wine unites them - anonymous
Wine is the most civilized thing in the world - Ernest Hemingway
Wine makes daily living easier, less hurried, with fewer tensions and more tolerance - Benjamin Franklin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform