This section demonstrates the use of fsetpos() function in C.
This section demonstrates the use of fsetpos() function in C.This section demonstrates the use of fsetpos() function in C. The function fsetpos() is used to set the position of the stream to the location indicated by the information in pos. This information is obtained from the function fgetpos().
Its syntax is: fsetpos(File *stream,const fpos_t *pos)
This function sets the file position and state indicators for the stream pointed to by stream according to the value of the object pointed to by pos, where a value is obtained from the function fgetpos() on the same stream. In the following code, the function fopen(file, "w") open a file and allow to perform write operations. The fputs() function writes the string "That is an example of fsetpos function" into the file. Then, we have used the fsetpos() function that sets the file position for the stream which allows the fputs() function to replace the string "That" with "This".
Here is the code:
#include <stdio.h> int main() { |