FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Converte a txt file
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Converte a txt file

Posted: Sat Jun 25, 2016 10:15 AM
My friend give me a big big txt with DATA
I have this file txt and I wish converte it into a dbf

Code (fw): Select all Collapse
:Record 
-Nome
17 Marzo
-Tipo_Piatto
Bevande
-Ing_Principale
China Martini
-Persone
1
-Note
 -
-Ingredienti
2/10 ==== Panna Liquida
Alcune Gocce ==== Liquore Allo Zabaglione
2/10 ==== Vanil Zucca
3/10 ==== Illycaffè Espresso
3/10 ==== China Martini
-Preparazione
Mettere i primi tre ingredienti nello shaker con ghiaccio. Mischiare la panna liquida con lo zabaglione. Versare il contenuto dello shaker nel bicchiere (doppia coppetta da cocktail) ed aggiungere il resto.
:Record



when on the file the procedure read this row
:Record
-> it must append new record

when on the file the procedure read this row
-Nome
-> insert the next row into a field Name

when on the file the procedure read this row
-Ing_Principale
-> insert the next row into a field PRINCIPALE



when on the file the procedure read this row
-Persone
-> field PERSONE ( NUMBER)

when on the file the procedure read this row
-Note
-> field NOTE 255 CR

when on the file the procedure read this row
-Ingredienti
-> field iNGRE 255 CR

when on the file the procedure read this row
-Preparazione
->field PREPARA 255 CR

Someone can help me pls ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM

Re: Converte a txt file

Posted: Tue Jun 28, 2016 12:42 AM
Here is some code to get you started:

Code (fw): Select all Collapse
     
      cTxtFile = MemoRead( cRCFile ) 
      nFrom = 1 

      while nFrom < Len( cTxtFile ) 
         cLine = ExtractLine( cTxtFile, @nFrom ) 
         ... 

      end
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: Converte a txt file

Posted: Tue Jun 28, 2016 06:46 AM

thanks

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion