C examples for stdio.h:fsetpos
function
<cstdio> <stdio.h>
Set position indicator of stream. Restores the current position in the stream to pos.
int fsetpos ( FILE * stream, const fpos_t * pos );
Parameter | Description |
---|---|
stream | FILE object |
position | Pointer to a fpos_t object containing a position previously obtained with fgetpos. |
On success, it returns zero.
On failure, a non-zero value is returned and errno is set to a system-specific positive value.
#include <stdio.h> int main ()//from w w w. j av a 2 s. c o m { FILE * pFile; fpos_t position; pFile = fopen ("main.cpp","w"); fgetpos (pFile, &position); fputs ("That is a test",pFile); fsetpos (pFile, &position); fputs ("This is a new test",pFile); fclose (pFile); return 0; }