ReadFile and binary data
a question: in DOS programming you can read/write a file in either ascii or binary mode. which mode do the windows functions use? i suppose it detects which mode it needs to use.
also, when i read data from a file, the data usually has both characters (ascii) and numbers (integers). how can i detect if a byte of data is supposed to be an integer rather than a character? i hope you understand my question. i wrote a program to record the ascii number of every byte in a file (using "(int) char"), and the byte that contained the integer 19 returned a 19, is there a way to distiguish this from "DC3," which is the character associated with ascii code 19?
Sounds more like a problem in your ascii to int function.
Are you sure you are only sending in one char at a time not giving it a pointer to the rest of the file buffer?
Try copying a single char from the buffer to a seperate variable (ie char cChar; ) and converting that.
Best way is to GetFileSize(), GlobalAlloc() this +1 chars (bytes) and read the whole file, at once, to this buffer.
Close the file.
copy single char to temp single char buffer