creating DBF file from text file

Re: creating DBF file from text file

Postby Ehab Samir Aziz » Fri Aug 10, 2012 11:59 am

How can I detect end of page character chr(012) instead of Total string ?
Ehab Samir Aziz
 
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Re: creating DBF file from text file

Postby Ehab Samir Aziz » Fri Aug 10, 2012 10:50 pm

I tried that code but with any idea about the how can I display the UTF contents for memo field ?

Code: Select all  Expand view  RUN

#include "fivewin.ch"
#include "hbclass.ch"
#include "fileio.ch"


external ordkeyno, ordkeycount, ordKeygoto

function main()
*--------------------------

fillDB()
   
return nil

PROCEDURE FillDB
LOCAL oFile := TFileRead():New( "F:\programs\clipper\FWH\tdata\Docucollect\all.txt101_data_PP.txt" )
LOCAL cTemp := "",cTemp1:= "",cTemp2:= "",cTemp3:= "",cTemp4:= "",cTemp_var:= ""
LOCAL cAcNb := ""
Local nRecNo:=0,old_nRecNo:=0
CreateDBF()

oFile:Open()
IF oFile:Error()
    msgStop( oFile:ErrorMsg( "FileRead: " ) )
ELSE
    WHILE oFile:MoreToRead()
           
       
       
                cTemp1:=cTemp:= oFile:ReadLine()
               
                        IF "BANK OF Cyprus" $ cTemp1
               
        cTemp1:= oFile:ReadLine()
        cTemp2:= oFile:ReadLine()
        cTemp3:= oFile:ReadLine()
        cAcNb := padL( allTrim( subStr( cTemp3, 30 ) ), 12 )
        test->( dbAppend() )
        test->ACNB := cAcNb
        ? cAcNb
                            cTemp_var := cTemp1 + chr(013) + chr (010) +;
                            cTemp2 + chr(013) + chr (010) +;
                            cTemp3 + chr(013) + chr (010)
                                        test->TEXT += cTemp_var
       
                        endif      
                        test->TEXT += ( " " + allTrim( cTemp ) + chr(013) + chr (010) )
       
    ENDDO
    oFile:Close()
ENDIF
test->( dbCloseArea() )
RETURN

STATIC PROCEDURE CreateDBF()
LOCAL aStru := {}

aAdd( aStru, { "ACNB", "C",  12, 0 } )
aAdd( aStru, { "TEXT", "M", 10, 0 } )
dbCreate( "TEST", aStru,, .T., "test" )
RETURN

 
Ehab Samir Aziz
 
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 48 guests