Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Strange happenings with COPY TO ... DELIMITED
Message
 
 
À
08/05/2003 22:36:56
Gavin Reid
L & M Marketing Pty Ltd
Frenchs Forest, Australie
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00786608
Message ID:
00786611
Vues:
22
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--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform