Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Limit of FGETS()
Message
 
À
30/11/2005 12:23:59
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 7 SP1
Divers
Thread ID:
01073305
Message ID:
01073460
Vues:
13
>Help says the limit of FGETS() is 8192 characters. Is there a way to get around this limit?
>
>TIA!
It depend how big is the file. But if one line is more then 8192b I suppose it is huge :-)

Based on Cetin's anser:
#define BYTES_TO_READ 16384 && Or whatever

lnFileHandler = FOPEN("MyHugeFile.TXT")
IF lnFileHandler < 0
   RETURN
ENDIF
LOCAL lcText, lnAT, lcLine
m.lcText = []
DO WHILE NOT FEOF(lnFileHandler)
   m.lcText = m.lcText + FREAD(lnFileHandler, BYTES_TO_READ)
   lnAT = AT(CHR(13),m.lcText)
   DO WHILE lnAT # 0
      m.lcLine = LEFT(m.lcText, lnAT-1) && The Line w/o CR
      ProcessLine(m.lcLine) && Do something with the line
      m.lcText = SUBSTR(m.lcText, lnAt+2) && To Skip LineFieed (CHR(10)) If any, if not just change this line to lnAT+1
      lnAT = AT(CHR(13),m.lcText)  
   ENDDO
ENDDO
IF NOT EMPTY(m.lcText)
   ProcessLine(m.lcText) && Process the final string if it is not empty
ENDIF
(not tested)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform