Converte a txt file

Converte a txt file

Postby Silvio.Falconi » 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: Select all  Expand view

: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Converte a txt file

Postby James Bott » Tue Jun 28, 2016 12:42 am

Here is some code to get you started:

Code: Select all  Expand view
   
      cTxtFile = MemoRead( cRCFile )
      nFrom = 1

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

      end
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Converte a txt file

Postby Silvio.Falconi » Tue Jun 28, 2016 6:46 am

thanks
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

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