Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
My file to string does nor have CR characters
Message
De
22/10/2014 13:53:08
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01609739
Message ID:
01609774
Vues:
51
Although it's one statement, each call to strtofile() is going to open the file (and if you're using append option) seeking to the end of the file, writing the data out, then closing the file -- in a loop that's going to kill performance (especially if there is going to be an antivirus involved). If you're calling strtofile() to append to file within a loop, you're probably better off using low-level file routines -- fopen() at the beginning (then optionally fseek() to end of the file), then within loop performing a fwrite() or fputs() (fputs appends a newline for you), then fclose() after the loop. You can optionally call fflush() after fwrite()/fputs() to make sure data is being written at that moment.

>I have one warning about strtofile in a loop and it depends on how items are in your loop.
>
>Everytime you call strtofile() the virus scanner, if installed and running, will inspect your newly changed file. If your file gets large and you are in a tight scan with many items you will have a huge performance hit.
>
>I love filetostr(), but in my one case I had to switch to level file operations fopen and fwrite and all that to avoid the performance hit.
>
>Just saying...
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform