Does the fgets() function move the file pointer automatically to the position till the parameter of the size mentioned by me ?
for example :
the content of the file p.txt is " I am a good boy " . After using fgets(a,5,fp1) does the file pointer move 5 positions ahead ?
Could not find this clearly in any book . Hence the query .
after using fgets(a,5,fp1) does the file pointer move 5 positions ahead ?
The pointer fp1
is not affected by the fgets
call (or any other stdio
I/O routine); The FILE
object that fp1
points to will be updated to reflect the new file position, but the pointer itself does not change.
The file pointer is not modified by the fgets
function.
However, the file offset is incremented by the number of bytes actually read.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With