I'm trying to do disk reads and writes when programming in C++ in the win32 console mode.
I can create the file on disk using CreateFile(), but I can't figure out how to read or write to that file. I used the ReadFile() and WriteFile() functions but I just get an access violation error ("program encountered an error and needs to close" thing).

So, now that I have created the file on disk, how do I read or write to it in console mode?

6 Years
Discussion Span
Last Post by MandrewP

Sorry guys, I figured this out myself. I need to use the fstream class to do this. Funny how before I posted this question I couldn't seem to find the answer, through MSDN and other sources. But as soon as I post the question, it seems so clar now! LOL

Anyway, I may post an answer to this own question of mine later for someones else's benefit, or someone here can do that and maybe give me even more insight.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.