Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do you move the record with fseek()
Message
From
01/07/1999 12:56:22
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00236108
Message ID:
00236547
Views:
12
>>>>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)
------------------------
Hi Ed and it works... thanks a lot for the code..... :)
Robert Keith
Independent Developer
San Antonio, Texas
E-mail address:
rebelrob1@yahoo.com
Previous
Reply
Map
View

Click here to load this message in the networking platform