Information générale
Catégorie:
Codage, syntaxe et commandes
>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement