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:
00430506
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.

I view mine with windows notepad and have no problem. I am not familiar with Notebook.
Bret Hobbs

"We'd have been called juvenile delinquents only our neighborhood couldn't afford a sociologist." Bob Hope
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform