Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Renaming Files with error trapping
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01338855
Message ID:
01338899
Views:
16
>Hello, I have a document management module of my application and part of it requires taking file MyFile.txt and renaming it to Last_Name_First_Name_Date.txt.
>
>I use the VFP Rename function and trap for the existence of the source and also the destination, but get caught up in situations where the user has the file open ...
>
>Anybody have any suggestions on how to handle this type of situation (or similar ones while we're at it, like maybe the original file is read-only, etc.)
>
>Thanks
>
Kevin,

Either use TRY/CATCH approach (recommended) or you may check with fopen following with fclose. There is ~0.00000000000001 percent probability the user will open the file between the fopen and fclose calls, though.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform