Page 1 of 1

TXT Unix To Dos

Posted: Fri Feb 15, 2019 4:23 pm
by miragerr
Hello friends,

I get a TXT file in UNIX format, how to open it to read the file in the DOS format by Fivewin, I tried with ttxtfile, more does not have the lines breaks

Is there any way to read the file?

I'll be waiting.

Re: TXT Unix To Dos

Posted: Fri Feb 15, 2019 4:41 pm
by Jack
Hi,
I think that unix use only chr(10) and not chr(13)+chr(10) .
Replace CHR(10) with CHR(13)+CHR(10) .

Try it,

Philippe

Re: TXT Unix To Dos

Posted: Fri Feb 15, 2019 8:55 pm
by cnavarro
Use function hb_eol()

Re: TXT Unix To Dos

Posted: Sat Feb 16, 2019 12:25 am
by miragerr
How ?

oFile := TTxtFile():New( cFileName ) << File is Unix Code or UTF-8 not BOM

Do While !oFile:Eof()
cLine := oFile:ReadLine() // << here is the problem
? cLine
oFile:Skip()
Enddo

Re: TXT Unix To Dos

Posted: Sat Feb 16, 2019 2:48 am
by nageswaragunupudi

Code: Select all

cText    := MEMOREAD( cFile )
aLines   := HB_ATokens( cText, CHR(10) )
XBROWSER aLines