Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do you move the record with fseek()
Message
De
30/06/1999 22:17:56
 
 
À
30/06/1999 21:59:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00236108
Message ID:
00236276
Vues:
11
>>>My code is
>>>in_string = fgets(pipe_in)....
>>>I want to move the record pointer back to the start of the line
>>>just read in. The start of the line is not BOF. any ideas?
>>>Sample code would help, thanks ... :)
>>
>>Save the current position in the file before issuing the FGETS(), and then do an FSEEK() back to that point in the file.
>-----
>Hi Ed and thanks for your reply...
>Could you send me sample code on how to do that?

It's fairly simple to do; FSEEK() returns the offset from the beginning of the file after it fires, so the following code fragment shows how to do an FGETS() and go back to where the file pointer was when you started:

* nFH is the file handle returned by FOPEN()
LOCAL lnFilePos, lcInputBuffer
lnFilePos = FSEEK(nFH,0,1) && go 0 bytes from where you are
lcInputBuffer = FGETS(nFH,max # of bytes to accept without a CR)
=FSEEK(nFH,lnFilePos,0)
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform