Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
STRTOFILE and Carriage Returns
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00430477
Message ID:
00430499
Views:
11
>>I need to use the STRTOFILE command to write a strint to a file. The problem I am having is the string needs to have carriage returns included within it (or I could break it up and write the string in several sections). I tried using the following code:
>>
>>buildstr="Error occured at "+ttoc(datetime())+chr(13)+chr(13)
>>buildstr=buildstr+"Error # "+alltrim(str(xerno))+chr(13)+chr(13)
>>buildstr=buildstr+"Error Message: "+alltrim(xmsg)+chr(13)+chr(13)
>>buildstr=buildstr+"Program Line # "+alltrim(str(xline))
>>
>>strtofile(buildstr,"ERRORLOG.TXT",.f.)
>>
>>
>>However, the resultant text file did not contain the necessary carriage returns. It just substituted strange characters for the chr(13)'s.
>>
>>I changed the code to read:
>>
>>buildstr="Error occured at "+ttoc(datetime())+chr(13)+chr(10)+chr(13)+chr(10)
>>buildstr=buildstr+"Error # "+alltrim(str(xerno))+chr(13)+chr(10)+chr(13)+chr(10)
>>buildstr=buildstr+"Error Message: "+alltrim(xmsg)+chr(13)+chr(10)+chr(13)+chr(10)
>>buildstr=buildstr+"Program Line # "+alltrim(str(xline))
>>
>>strtofile(buildstr,"ERRORLOG.TXT",.f.)
>>
>>
>>This change put in a carriage return but still the strange characters appears. I then changed to only use the chr(10)'s but that didn't work either.
>>
>>What am I doing wrong?
>
>I use the CHR(13) + CHR(10) and have no problems. What text editor are you using to view the result?

I am using Notebook to open up the file to view it.
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform