Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Appending text to low level file
Message
De
01/07/1999 09:37:37
Paul Frost
Instem Computer Systems Ltd
Stone, Royaume Uni
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00236407
Message ID:
00236420
Vues:
13
>Hello,
>I want to create a error log file, but I don't know how to write to a file without loosing the existing text.
>Is there a easy way to write "additive" to file?
>Thanks for your help!

If your using low-level functions try something along the lines of :

fhandle = fopen("FILE",2) && try to open file
if (fhandle == -1) && if failed
fhandle = fcreate("FILE") && create file
else
fseek(fhandle,0,2) && otherwise seek to end of file
endif
&& now can append write to file

BTW - beware of letting the file grow too big. I normally put a check on the file size & create an archive copy once it reaches a certain size, after getting massive log files due to a network failure, appending to the file once a second for an entire weekend.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform