C fseek() function in C Language
Categories: C language
The fseek() function is used to set the file pointer to the specified offset. It is used to write data into file at desired location.
int fseek(FILE *stream, long int offset, int whence)
There are 3 constants used in the fseek() function for whence: SEEK_SET, SEEK_CUR and SEEK_END.
fp = fopen("myfile.txt","w+");
fputs("This is javatpoint", fp);
fseek( fp, 7, SEEK_SET );
fputs("sonoo jaiswal", fp);
This is sonoo jaiswal