General information
Category:
Coding, syntax & commands
>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()
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only