TXT Unix To Dos

TXT Unix To Dos

Postby miragerr » Fri Feb 15, 2019 4:23 pm

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.
Jackson Douglas C. Brito
Boa Vista - RR - Brasil
FWH 12.09 Last Build
xHarbour Free
UESTUDIO
SQLRDD
User avatar
miragerr
 
Posts: 140
Joined: Tue Oct 11, 2005 2:36 am
Location: Brasil

Re: TXT Unix To Dos

Postby Jack » Fri Feb 15, 2019 4:41 pm

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
Jack
 
Posts: 288
Joined: Wed Jul 11, 2007 11:06 am

Re: TXT Unix To Dos

Postby cnavarro » Fri Feb 15, 2019 8:55 pm

Use function hb_eol()
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: TXT Unix To Dos

Postby miragerr » Sat Feb 16, 2019 12:25 am

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
Jackson Douglas C. Brito
Boa Vista - RR - Brasil
FWH 12.09 Last Build
xHarbour Free
UESTUDIO
SQLRDD
User avatar
miragerr
 
Posts: 140
Joined: Tue Oct 11, 2005 2:36 am
Location: Brasil

Re: TXT Unix To Dos

Postby nageswaragunupudi » Sat Feb 16, 2019 2:48 am

Code: Select all  Expand view  RUN
cText    := MEMOREAD( cFile )
aLines   := HB_ATokens( cText, CHR(10) )
XBROWSER aLines
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10662
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: jmartial and 42 guests