Reasons & Workarounds For ostream Failures
IDE: VS .NET 2002
Operating System: XP Pro CE SP1
What are the cases in which cout, cerr, and clog would fail? Out of these cases, which would allow for my program to communicate an error to a user, and what's the best way about doing this?
The only option I've come across is either using MessageBoxA(); or MessageBoxW(); if I ever get into unicode work, or using file streams to communicate errors. However, each of these cases seems to depend on free memory on the system as to which might not exist.
I'm not entirely sure, what, exactly cout, cerr, and clog are in terms of the operating system, I realize that cout is just a cool way of overloading ostreams, but I don't think just knowing that is enough in this case. I don't want my program to just crash and not tell the user a thing, granted my program might infact be more of a nuisance than a help if I'm taking precious memory in the event of high cpu usage, but even so I'de like to convey what went wrong in the system or my program in the event of an output failure nonetheless. It would also be good to know how to convey and work around istream errors as well.
Currently I am at the point where I'm checking the badbit to see if any error had occured, however even if I chick this bit I won't know what went wrong in the system Even moreso, if something went wrong I'm not sure how to deal with it. I'de like to know what went wrong and how to deal with it.
Currently I'm only looking for windows related solutions as I haven't delved much into the world of Linux/Unix, Windows serves my needs thus far. So my development will be reduced to just this area. I would assume that this is more of a Windows based question than a C++ question, however, I'm hoping there is a group of functions that I haven't found yet that would fix this problem (I don't really like dealing with the WinAPI sometimes..)