Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Character line more than 254!
Message
De
04/06/1998 15:26:43
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
01/06/1998 10:52:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00102865
Message ID:
00104896
Vues:
27
>I use FGETS() to retrieve the line.
>How can i get one line at a time?
>If i use nBytes it might be one or two line that it gives me.
>
>Nick,

* start with an empty buffer
lcBuff=""
do whille !feof(lnHandle)
* get one buffer full and add to last buffer's remainder
lcBuff=lcBuff+fread(lnHandle, 2048) && use your cluster size or any value you find useful
do while occurs(chr(13), lcBuff)>0
* extract one line at a time
lcOneLine=mline(lcBuff, 1)
* maybe it should be _mline+1, or _mline+2 depending on the line delimiter of your source file
* _mline is system vairable, see in Help
lcBuff=subs(lcBuff, _mline)
Do WhatEver with lcOneLine
endd
endd
* do something with the last line though it's probably empty
Do WhatEver with lcOneLine

I use this approach a lot when doing things like that - speeds things up considerably, because it reads just plain bytes, not having to analyse for line terminators. Actually, FGets internally works something like this, but its engine is obsolete and it doesn't recognize lines longer than 254.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform