LEER ARCHIVOS TXT

LEER ARCHIVOS TXT

Postby davidObarrio » Thu Jul 31, 2014 8:07 pm

Amigos

estoy leyendo y quiero sacar informacion por renglon de dicho archivo y guargar por renglon en un archivo DBF, en el cual hay un campo alfanumerico de 300 caracteres.

cada rengon del txt no son iguales de largo (o cantidad de caracteres), Nunca supera los 300.

?¿ como puedo saber cuando hago el corte cuando hay un salto de renglon en dicho TXT

Code: Select all  Expand view
oFile:= TTxtFile():New( cFile )

  while !oFile:EOF()

    cLinea := oFile:ReadLine()

     MsgInfo(cLinea)
   
    (archivodbf)->(DBAPPEND())
    (archivodbf)->TXT := cLinea
    (archivodbf)->( DBRECALL() )
    (archivodbf)->( DBCOMMIT() )

    oFile:Skip()
  EndDo
 
  oFile:End()
davidObarrio
 
Posts: 72
Joined: Tue Oct 02, 2012 4:36 pm

Re: LEER ARCHIVOS TXT

Postby cmsoft » Thu Jul 31, 2014 9:32 pm

Code: Select all  Expand view
oFile:= TTxtFile():New( cFile )

  while !oFile:EOF()

    cLinea := oFile:ReadLine()

     MsgInfo(cLinea)
   
    (archivodbf)->(DBAPPEND())
    replace (archivodbf)->TXT with cLinea
    (archivodbf)->( DBRECALL() )
    (archivodbf)->( DBCOMMIT() )

    oFile:Skip()
  EndDo
 
  oFile:End()
User avatar
cmsoft
 
Posts: 1189
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina


Return to FiveWin para Harbour/xHarbour

Who is online

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

cron