ReadFile Help

This is a discussion on ReadFile Help within the Windows Programming forums, part of the Platform Specific Boards category; How do you tell ReadFile to only read in 1 char of the file and then move to the next, ...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    319

    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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,751
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 03:41 PM
  2. ReadFile();
    By Queatrix in forum Windows Programming
    Replies: 8
    Last Post: 05-02-2005, 03:42 PM
  3. readfile
    By ZeroG in forum Windows Programming
    Replies: 3
    Last Post: 09-21-2004, 09:20 AM
  4. Using API function ReadFile()
    By Echidna in forum Windows Programming
    Replies: 4
    Last Post: 10-23-2001, 11:33 PM
  5. ReadFile?
    By SyntaxBubble in forum Windows Programming
    Replies: 2
    Last Post: 10-23-2001, 02:13 AM

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