Hello.
I am wondering how EOFs are indicated to either the cstdio functions or the fstream functions. Mainly I am wondering how it differentiates it from data. For example, if EOF is a 2-byte code wouldn't this break the system by inserting a 'false' eof flag:
for (int i=0; i<256; ++i)
for (int ii=0; ii<256; ++ii)
fout<<(unsigned char)i<<(unsigned char)ii;
And the same argument would obviously extend to any length of the eof flag. I am wondering if there actually is a way to (accidentally or not) create a false EOF flag. I mainly wonder because I am trying to define a file format for some of my classes to save their data to a file and I am noticing that most 'official' files start off by listing their size in some way or another, and I am wondering if that is to help define where the EOF is.