Okay, I think I see a couple of things that you may or may not be having trouble with in your code. First, I'm not sure why you got away without the statement
"#include <string>" in your code. I'd definitely change that first. Then, to be sure that I get what I need for file manipulations forget about the
"#include <ofstream>" or "#include <ifstream>" thing. The best way to do that is to use the easier and all inclusive "#include <fstream>". It does both and won't add pounds to a program unneccessarily
You then have several options to correct the errant output / input with a string. I'll direct you first to the favorite C and C++ reference URL,
It can be used for almost all your C / C++ lookup needs. And it is correct on all points and occasions that I've used it.
Next, I will direct you to a few specific pages that will add to your C++ I/O prowess from within that site. Don't get confused, there is more than one
possible solution and that is a very C / C++ thing in itself. Here you go:
Okay, that isn't as much reading as it seems. Give it a look, especially the last three. If the light bulb doesn't go off, then repost what is happening after your next attempt and I'll show some functional code for it. Good luck and think about the string object.