Thread: ReadFile Help

  1. #1
    Registered User
    Join Date
    Nov 2002

    ReadFile Help

    How do you tell ReadFile to only read in 1 char of the file and then move to the next, when it's in a buffer then need to check for a space, here is my code...

    ReadFile(IpsFile, //valid handle
    FileBuffer, //char FileBuffer[64];
    1, //Read in 1 byte from the file
    &Read, //How many bytes were read
    0); //Not used here

    when i output the FileBuffer the result is jibberish text, i thought it would be the first letter of the txt file????

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Perhaps you need to say how you were outputting the buffer.

    For example, expecting a single char to be a string would almost certainly result in some garbage being printed.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need help with ReadFile need to read in from : to -
    By Anddos in forum C++ Programming
    Replies: 9
    Last Post: 04-11-2007, 02:41 PM
  2. ReadFile();
    By Queatrix in forum Windows Programming
    Replies: 8
    Last Post: 05-02-2005, 02:42 PM
  3. readfile
    By ZeroG in forum Windows Programming
    Replies: 3
    Last Post: 09-21-2004, 08:20 AM
  4. Using API function ReadFile()
    By Echidna in forum Windows Programming
    Replies: 4
    Last Post: 10-23-2001, 10:33 PM
  5. ReadFile?
    By SyntaxBubble in forum Windows Programming
    Replies: 2
    Last Post: 10-23-2001, 01:13 AM
Website Security Test