Previous | Home | Next |
Description
The C library function, The fsetpos( ) function moves the file position indicator to the point specified by the object pointed to by position.
Declaration
Following is the declaration for fsetpos() function.
int fsetpos(FILE *stream, const fpos_t *pos)
Parameters
stream - The stream whose file position indicator is to be modified.
pos - This is a Pointer to a fpos_t object containing a position previously obtained by calling fgetpos function.
Return Value
If fsetpos( ) fails, it returns nonzero. If it is successful, it returns zero.
Example
int main () { FILE * fp; fpos_t position; fp = fopen ("file1.txt","w"); fgetpos (fp, &position); // Store New Position fputs ("What an Idea",fp); fsetpos (fp, &position); // Set Current Position to New Position fputs ("This",fp); fclose (fp); return 0; }
Output
On success : Return 0 On Error : Returns a non-zero value
Previous | Home | Next |