creating DBF file from text file

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

Re: creating DBF file from text file

Post by Ehab Samir Aziz »

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

Post by Ehab Samir Aziz »

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

Code: Select all

#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

 
Post Reply