Finding the end of an exe/file

This is a discussion on Finding the end of an exe/file within the C++ Programming forums, part of the General Programming Boards category; Is there some special execution character at the end of every program? I need to be able to read all ...

  1. #1
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    891

    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

  2. #2
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ISO 8583 Message Parser in C?
    By nadeer78 in forum Projects and Job Recruitment
    Replies: 7
    Last Post: 06-16-2008, 12:56 AM
  2. singly linked to doubly linked
    By jsbeckton in forum C Programming
    Replies: 10
    Last Post: 11-06-2005, 06:47 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. socket newbie, losing a few chars from server to client
    By registering in forum Linux Programming
    Replies: 2
    Last Post: 06-07-2003, 11:48 AM
  5. Next Question...
    By Azmeos in forum C++ Programming
    Replies: 3
    Last Post: 06-06-2003, 02:40 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21