Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Low Level Function question
Message
From
03/01/2002 10:35:42
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00600268
Message ID:
00600282
Views:
17
>I'm using low level file fuctions to log certain miscellaneous errors to a text file (I generally log all errors to the SQL Server database this app uses - but if I can't get a connection, or the append fails, I use the text file).
>
>If the file already exists, I open it using FOPEN, then move the pointer to the end of the file using Fseek(lnFileHandle, 0, 2) and then tried using both FPUTS and FWRITE to append to the file.
>
>This didn't work and I'm not sure why. When I changed the code to read the contents of the file to a variable using FILETOSTR and then adding to the variable before using FPUTS, it worked OK. Is this the only way to do this - or is it possible to append to a text file using the low level functions without using FILETOSTR first?

StrToFile("Error Message" + chr(13) + chr(10), MyLog.txt, .T.)

The third parameter is "Additive" - don't overwrite file, append instead.

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform