Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CR and LF
Message
De
23/02/2001 23:07:15
 
 
À
23/02/2001 10:13:30
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00478835
Message ID:
00479160
Vues:
32
>How can I place a Carriage Return and Line Feed at the end of a line in a text file?
>
>We are creating a text file for a customer so they can load the data in the text file into their main frame.
>
>We write some of the data to the text file by stringing it together as follows:
>
> =STRTOFILE(value1 + value2 + CHR(10), "myfile.txt", .t. )
>
>Our customer says that there isn't a CR + LF at the end of any line.
>
>What is the right way to place a CR + LF at the end of each line in a text file?
>
>Thanks,
>
>Jerryt

* assuming less than 65000 lines
local array lalines[1]

local i, lcContents, lcOutput

lcContents = filetostr(filename)
lcOutput = ""

for i = 1 to alines(laLines, lcContents)
lcOutput = lcOutput + laLines[i] + chr(13) + chr(10)
endfor

=strtofile(lcOutput, outfilename)

* low level file io is faster for larger files

* see: fcreate(), fputs(), fclose()
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform