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

Click here to load this message in the networking platform