Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
STRTOFILE and Carriage Returns
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00430477
Message ID:
00430621
Vues:
15
>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?
Why not use Low Level file commands and write to the file with FPUTS()?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform