Sergey, thanks for replying so quickly. How would performance compare between using STRTOFILE versus creating the file using fcreate, closing the file, then reopening in unbuffered write only mode and using fputs to write the data?
>>I am opening a low level text file to add temporary logging in an application to try to figure out where an application is freezing. The user eventually uses the windows task manager to end the program. How can I catch the fact that the application is being externally ended so I can close the file handle so the data in the file will be retained.
>>
>>Or is there another way to be able to create a text log file to capture what I need to try to track down where my application is freezing?
>
>Use STRTOFILE() to write each line. It doesn't keep file open.
>
>
>STRTOFILE(lcMessage + CHR(13) + CHR(10), lcLogFileName, .T.)
>