FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour About end of file (txt)
Posts: 332
Joined: Thu Nov 17, 2005 09:11 PM
About end of file (txt)
Posted: Mon May 26, 2008 05:26 PM

Hello

Look that code please

Resp := LOpen("TEXTO.TXT",0)
Do While .t.
Resp1 := cFReadLine(Resp)

 ========> why i can test end of file to abort this while?

 Loop

Enddo

Thanks
Wanderson.

Posts: 77
Joined: Sun Aug 26, 2007 11:53 PM
About end of file (txt)
Posted: Mon May 26, 2008 10:50 PM
I modify incoming formats this way
getcFile := cGetFile32("Print Files (*.ofx; *.ofc)| *.ofx; *.ofc |" ,"Please select a file",1)

nBinary := FOPEN(getcFile)
IF (nError := FERROR()) # 0
   MsgInfo('Cannot open '+getcFile+CRLF+::FError(nError))
ELSE
    MEMORY(-1)  // Maybe not necessary now
     IF FREADln(nBinary, @cBuffer, 32768, CHR(0))
     // CR & LF is stripped out and LF placed in the correct position
     // STRTRAN(  <cString>, <cLocString>, <cRepString>, <nPos>, <nOccurences> ) --> cReturn
     cBuffer := STRTRAN(cBuffer, CHR(13))            //replace CR with Null
     cBuffer := STRTRAN(cBuffer, CHR(10))            //replace LF with Null
     cXML := STRTRAN(cBuffer, '<', CHR(10)+'<')      //replace < with <LF
ENDIF
FCLOSE(nBinary)
//  then saved to a new file
cXMLBnkStment := SUBSTR(getcFile,1,RAT('\',getcFile))+'BNKSTMT.XML'
nHandle:=FCREATE(cXMLBnkStment)
FWRITE(nHandle, cXML)
FCLOSE(nHandle)
It's very fast with xHarbour
Hope this helps

JH
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
About end of file (txt)
Posted: Mon May 26, 2008 11:04 PM
Wanderson,

This is a real fast way to do it:
    cTxtFile = MemoRead( cRCFile ) 
      nFrom = 1 

      while nFrom < Len( cTxtFile ) 
         cLine = ExtractLine( cTxtFile, @nFrom ) 
         ... 
         SysRefresh() 
      end
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 332
Joined: Thu Nov 17, 2005 09:11 PM
About end of file (txt)
Posted: Tue May 27, 2008 03:34 PM

Thanks Antonio and JH.

Continue the discussion