Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Appending text to low level file
Message
From
01/07/1999 09:37:37
Paul Frost
Instem Computer Systems Ltd
Stone, United Kingdom
 
 
To
01/07/1999 09:24:10
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00236407
Message ID:
00236420
Views:
12
>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform