Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange happenings with COPY TO ... DELIMITED
Message
 
 
To
08/05/2003 22:36:56
Gavin Reid
L & M Marketing Pty Ltd
Frenchs Forest, Australia
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00786608
Message ID:
00786611
Views:
21
This message has been marked as the solution to the initial question of the thread.
Hi Gavin,

The notepad and some other editors don't keep file open. They load it into memory and work with that copy. In case like that file isn't technicaly open.

>Hi All,
>
> I've come across a strange one when using VFP6.0 SP5 to copy data to a comma delimited file. I have a generic print screen in my application that allows any report in the application to be output to printer, preview, excel, pdf or delimited file. The following code performs the delimited copy and checks a flag to see if there was an error.
>
>
>USE mytable
>cError = ON("ERROR")
>lOkToCreate = .T.
>ON ERROR lOkToCreate = .F.
>COPY TO myfile.txt DELIMITED WITH ~
>ON ERROR &cError
>IF lOkToCreate = .F.
>    * ----- Insert appropriate error message
>    WAIT WINDOW "File in use"
>ENDIF
>
>
>I then open the file in windows notepad and try the previous code again. To my surprise I don't get a message saying that the text file is in use.
>
>But if I try the following code:
>
>
>USE mytable
>COPY TO mytextfile.txt DELIMITED
>MODI COMM mytextfile.txt NOWAIT
>COPY TO mytextfile.txt DELIMITED
>
>
>I get a 'File is in use' error. It seems that certain text editors don't lock the file. Does anyone know of a fool proof way to check that a file isn't in use before trying to create it?
>
>Thanks,
>Gavin.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform