|
fgetposfunction
<cstdio> int fgetpos ( FILE * stream, fpos_t * position ); Get current position in stream Gets the information needed to uniquely identify the current value of the stream's position indicator and stores it in the location pointed by position.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. ParametersReturn ValueThe function return a zero value on success, and a non-zero value in case of error.Example
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
|