I’m trying to read from a file in C and after I’m done reading want to write to the same file. I’m trying to use fread() for this. Does anyone know if fread advances the pointer after it encounters “\0”? I mean after I finish reading do I need to advance the pointer or do I need to straight-away start writing into the file using fwrite ?
Share
freadwill advance the file position (not pointer) until it hitsEOF.However, it will not stop reading simply because it encounters
'\0'. In fact, evenfgetswill only stop reading when it encounters\n. No standard library function I know of stops reading a file at'\0'.