The parameter position should point to an already allocated object of the type fpos_t, which is only intended to be used as a paremeter in future calls to fsetpos.
To retrieve the value of the internal file position indicator as an integer value, use ftell function instead.
Parameters
Return Value
The function return a zero value on success, and a non-zero value in case of error.Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
Output:
1st character is A
2nd character is B
2nd character is B
2nd character is B
The example opens myfile.txt, reads the first character once and then it reads 3 times the same second character.
See also
| fsetpos | Set position indicator of stream (function) |
| ftell | Get current position in stream (function) |
| fseek | Reposition stream position indicator (function) |
