Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Text File
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00636084
Message ID:
00636211
Vues:
16
>>Hi
>>
>>How do I copy the contents of a variable to a text file, I know I use the COPY TO with fields from a table, but cant see anything to copy the variable?
>>
>>Thanks
>>Nelly
>
>Either STRTOFILE() or the low level (FCREATE(), FWRITE(), etc.) file functions. You'll have to convert the variable if it's not a string to one, however.

A special note, that if you use STRTOFILE to put a variable to a file. It is better if you try to limit the number of times you write to the file if you use the append option of the command. I found out early that the append to file takes more and more time as the file size becomes bigger. I was reading an input file and just thought I would write to an error file when data problems occured. So I would just get the error and append it to the file using STRTOFILE(). Well there were a ton of errors and the program slowed down to a crawl as it had to do many file open/write/close. So what I did was put the errors to a variable and then just wrote the variable to the error file every say 1,000 errors and in some cases only at the end of the program run. Just a little heads up if you liberally use STRTOFILE.
Bret Hobbs

"We'd have been called juvenile delinquents only our neighborhood couldn't afford a sociologist." Bob Hope
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform