Thread: trying to read all asci char's in files

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    17

    trying to read all asci char's in files

    Hi, I saw your encryption challenge and was a little intrigued by the option of being able to encrypt all asci files, and not just plain text, so I tried to do something similar with it myself. However, I ran into two significant problems. Firstly, what is the best way to take in the chars? I've tried this:
    Code:
    inFile>>letter;
    and:
    Code:
    inFile.get(letter);
    but neither will get all the asci char that seem to be in .exe files and the other non-readable files. The second problem is how do I know when the program has gone through the whole file? I can't do this:
    Code:
    while(!inFile.eof())
           {
           }
    because there may be a eof char in the middle of the exe. Could anyone through in a bit of wisdom?

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    A quick search on Google turned up this: http://ei.cs.vt.edu/~cs2604/spring99/binio.html
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. serial port - read chars twice
    By matze in forum Linux Programming
    Replies: 1
    Last Post: 12-07-2007, 07:32 AM
  2. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  3. How to read chars from a text file and use them in TChart
    By Bachatero in forum C++ Programming
    Replies: 1
    Last Post: 08-29-2006, 04:03 PM
  4. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 11:46 AM
  5. Replies: 3
    Last Post: 05-05-2004, 05:40 PM