FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TXT Unix To Dos
Posts: 140
Joined: Tue Oct 11, 2005 02:36 AM
TXT Unix To Dos
Posted: Fri Feb 15, 2019 04: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
Posts: 300
Joined: Wed Jul 11, 2007 11:06 AM
Re: TXT Unix To Dos
Posted: Fri Feb 15, 2019 04: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

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: TXT Unix To Dos
Posted: Fri Feb 15, 2019 08: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
Posts: 140
Joined: Tue Oct 11, 2005 02:36 AM
Re: TXT Unix To Dos
Posted: 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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: TXT Unix To Dos
Posted: Sat Feb 16, 2019 02:48 AM
Code (fw): Select all Collapse
cText    := MEMOREAD( cFile )
aLines   := HB_ATokens( cText, CHR(10) )
XBROWSER aLines
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion