FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Create Text File
Posts: 310
Joined: Mon Oct 10, 2005 05:10 AM
Create Text File
Posted: Fri Apr 11, 2008 12:45 AM

Hi All

I have to create a text file to send data to a bank - I created a database
with one field - I build each line in the databases and then use copy to
SDF with no delimiters but when the file is created it has an end of line
marker - when the file is imported to the bank it fails because of the end of line marker - can anyone suggest another way to do this.

Regards

Colin

Posts: 56
Joined: Wed May 23, 2007 02:01 PM
Create Text File
Posted: Fri Apr 11, 2008 01:09 AM
hello,

you can create txt files using the class TTxtfile:

cFile = 'MyOrder.txt'


oFile = TTxtFile():New( cFile )


select mBD
go top


while .not.eof()
   cLine = ''
   
    for ii=1 to fcount()
        cLine+=fieldget(ii)
    next
  
   oFile:Add( cLine )
   skip +1
enddo


oFile:Close()


return


regards
Yury Marcelino Al
yury030575@yahoo.com.br
vimansca@vimansca.com.br
Leme / SP - Brasil
Posts: 782
Joined: Wed Dec 19, 2007 07:50 AM
Re: Create Text File
Posted: Fri Apr 11, 2008 01:13 AM
Colin Haig wrote:I have to create a text file to send data to a bank - I created a database
with one field - I build each line in the databases and then use copy to
SDF with no delimiters but when the file is created it has an end of line
marker - when the file is imported to the bank it fails because of the end of line marker - can anyone suggest another way to do this.

Hi Colin:

The same way you fill the record field, you may fill a cLine character variable, then add it to a cText next way:

cText := ""

For nI := 1 To nTotalLines
   cLine := cYourTextLine
   cText += cLine + CRLF
Next

MemoWrit( "MyText.txt", cText )


I hope have been helpfull

Regards

Manuel Mercado
manuelmercado at prodigy dot net dot mx
Posts: 310
Joined: Mon Oct 10, 2005 05:10 AM
Create Text File
Posted: Fri Apr 11, 2008 02:38 AM

Thanks Yuri and Manual for your quick replies - I used the TTxtFile Class
and everything worked fine.

Regards

Colin

Continue the discussion