Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
StrToFile Error Handling?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00642867
Message ID:
00642872
Views:
13
>Does anyone have any sample code handy to wrap the StrToFile() function inside an error-tolerant wrapper, in case something else in the OS has it open? What I want to do is write to a textfile, and if it is already open for write, sit in a wait-suspend loop until it is available and then overwrite it. I am currently using a global Error Handler (from the awesome 1001 Things Hentzenwerke book), but I don't want to set that off with this operation.

You can use FOPEN() function to check if file is open somewhere else.
lnFH = FOPEN(lcFileName, 12)
IF lnFH > 0    && file isn't in use
  FCLOSE(lnFH)
  .....
ELSE
ENDIF
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform