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.
About end of file (txt)
-
- Posts: 77
- Joined: Sun Aug 26, 2007 11:53 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
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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Wanderson,
This is a real fast way to do it:
This is a real fast way to do it:
Code: Select all
cTxtFile = MemoRead( cRCFile )
nFrom = 1
while nFrom < Len( cTxtFile )
cLine = ExtractLine( cTxtFile, @nFrom )
...
SysRefresh()
end