Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find and Replace in huge text file
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01053411
Message ID:
01054108
Vues:
41
I forgot to mention it runs as fast as 68 find & Replace through 130 MB file in just 50 minutes, that is very good.

>I did some modification to Cetin Greg code, here it is:-
>
>#DEFINE MAXBUFFER 65530
>lhIn = FOPEN(lcFileIn)
>lhOut = FCREATE(lcFileOut)
>DO WHILE NOT FEOF(m.lhIn )
> lcBuffer = FREAD(m.lhIn, MAXBUFFER)
> lnfindlen = LEN(cFind)
> FOR lncounter = lnfindlen TO 1 STEP -1
> IF RIGHT(lcBuffer,lncounter) == SUBSTR(cFind, 1, lncounter)
> FSEEK(m.lhIn, -(lncounter), 1)
> lcBuffer = LEFT(lcBuffer,LEN(lcBuffer) - lncounter)
> ENDIF
> ENDFOR
> lcBufferOut = STRTRAN(lcBuffer,cFind,cReplace)
> FWRITE(m.lhOut, lcBufferOut)
>ENDDO
>FCLOSE(m.lhIn)
>FCLOSE(m.lhOut)
>
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform