How to read from files with windows.h?
May 28, 2014 at 6:41pm UTC
So, I am gonna keep trying, I haven't done this in a while and forgot how to do it, but anyway, I am reading from a file ("file.txt") and storing it into a char or something. I used OpenFile like this:
HFILE nameBase = OpenFile(
"file.txt", NULL, OF_READ);
Am I using it right? I don't really know what to do next. I can't find it in the 1400 page book I have, and I know its in there, but I will keep looking. I will let you know if i find it.
May 29, 2014 at 7:50am UTC
Unless you have good reason to do otherwise, use the standard C++ library version.
am reading from a file ("file.txt") and storing it into a char or something.
You have to decide what that something is.
But if you wanted to read and process lines from the file, the code might look like this:
2 3 4 5 6
while (std::getline(is, line))
// process line
May 29, 2014 at 2:32pm UTC
Ok, I was gonna do fstream, but I felt like trying to be elaborate and learn something new. Thanks anyway!
Topic archived. No new replies allowed.