Finding the end of an exe/file

Is there some special execution character at the end of every program? I need to be able to read all of a program's data into a buffer, but I don't know how to tell the computer to stop. An execution character is what I really need. The thing is, 0x00 doesn't work because that value is all over programs. Please help what you can.

"If you tell the truth, you don't have to remember anything"
-Mark Twain

i didn't know you had to test for an EOF character. doesn't the operating system automatically send you a special EOF at the end of the file?

there is no universal definite end to a program file. you could look for the scancode for the exit command, but exit commands vary so much. and exit commands don't have to be located at the end of the file. for all you know the writer of the file could put a bunch of seemingly random data at the end.

note: EOF is a #define'd integer, bigger than a byte. this is why functions like fgetc() return integers and not chars. it's probably the same or similar for iostreams.