I can open it, and calls to .is_open() indicate the ofstream is open, but nothing is ever written to it. It worked when compiled under c-free but now its not with codeblocks, which is weird cause from what I hear they both use the same compiler. I've been told that there are probably some compiler options I could change to make codeblocks a little less finicky.... but i don't know which ones, or how to.
Also, please don't laugh. I know this is bad coding practice, but I've been using my global fstream variable in a user defined class.... and its always worked swell up until now. My motto is if it ain't broke then don't spend hours trying to fix it.
You know, this is interesting. I've had a similar problem before with MinGW, only the fstream wasn't quite global. It was inside a global object. I was redirecting cout, cerr, and clog to files, and the messages would be written to the wrong streams or even not at all. I think it's a bug in MinGW and the reason why I no longer use it for any serious coding.
Try it on VC++ or GCC if you have access to Linux. There shouldn't be any problems.
Well whadyaknow? I added outfile.clear() to the beginning of main() and everything is working perfectly now. Isn't it weird how a problem can be bugging you for months and then all of a sudden an idea comes to you.... and presto.... its like why didn't I think of that before?