>>>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)