Click here to Skip to main content
15,889,266 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralDefining a new C++ library Pin
Anonymous27-Feb-05 9:26
Anonymous27-Feb-05 9:26 
GeneralMozilla Firefox Pin
stifmeister_ro27-Feb-05 9:24
stifmeister_ro27-Feb-05 9:24 
GeneralRe: Mozilla Firefox Pin
szcococut19-Jun-05 21:59
szcococut19-Jun-05 21:59 
GeneralListing files in a folder Pin
Tommy2d27-Feb-05 9:23
Tommy2d27-Feb-05 9:23 
GeneralRe: Listing files in a folder Pin
Ravi Bhavnani27-Feb-05 9:28
professionalRavi Bhavnani27-Feb-05 9:28 
GeneralRe: Listing files in a folder Pin
User 665827-Feb-05 9:41
User 665827-Feb-05 9:41 
GeneralDefining a new library in VC++ Pin
Anonymous27-Feb-05 9:21
Anonymous27-Feb-05 9:21 
GeneralRedirecting an ostream to a message box Pin
JS_H27-Feb-05 8:31
JS_H27-Feb-05 8:31 
I'm coding a set a functions to help me debugging by printing messages. I currently have 2 options; either on the console or in a file. That's enough for what I need but I'm just curious to know if it would be possible to do the same with a message box. That's what I have so far.

<br />
        enum modes {<br />
		CONSOLE, <br />
		FILE,<br />
		MSG_BOX,<br />
	};<br />
<br />
        class ErrorLogger {<br />
		std::ostream *stream;<br />
		std::ofstream *fileOut;<br />
	public:<br />
		ErrorLogger(modes mode) {<br />
			if (mode == CONSOLE)<br />
				stream = new std::ostream(std::cout.rdbuf());<br />
			else if (mode == FILE) {<br />
				fileOut = new std::ofstream("message.log");<br />
				stream = new std::ostream(fileOut->rdbuf());<br />
			}<br />
			else if (mode == MSG_BOX) {<br />
				stream = new std::ostream(/* what would go here? */)<br />
			}<br />
		}<br />
		std::ostream &GetStream() { return (*stream); }<br />
	};<br />
<br />
	template<class T> <br />
	void Print(ErrorLogger &logger, T _data) {<br />
		logger.GetStream() << _data;<br />
	}<br />


Thank you.

-edit-
I need to do something else than code tags for correct formating?
GeneralRe: Redirecting an ostream to a message box Pin
Aamir Butt27-Feb-05 19:58
Aamir Butt27-Feb-05 19:58 
GeneralWhy cannot get filename by handle directly Pin
sprewellkobe27-Feb-05 7:37
sprewellkobe27-Feb-05 7:37 
GeneralRe: Why cannot get filename by handle directly Pin
Ravi Bhavnani27-Feb-05 10:47
professionalRavi Bhavnani27-Feb-05 10:47 
GeneralRe: Why cannot get filename by handle directly Pin
sprewellkobe27-Feb-05 16:03
sprewellkobe27-Feb-05 16:03 
QuestionHow can I get the version information about a DLL? Pin
jparsons27-Feb-05 7:15
jparsons27-Feb-05 7:15 
AnswerRe: How can I get the version information about a DLL? Pin
geo_m27-Feb-05 7:46
geo_m27-Feb-05 7:46 
AnswerRe: How can I get the version information about a DLL? Pin
Ravi Bhavnani27-Feb-05 9:20
professionalRavi Bhavnani27-Feb-05 9:20 
QuestionCan two thread run the same thread function at the same time? Pin
tttyip27-Feb-05 6:37
tttyip27-Feb-05 6:37 
AnswerRe: Can two thread run the same thread function at the same time? Pin
Ravi Bhavnani27-Feb-05 6:56
professionalRavi Bhavnani27-Feb-05 6:56 
AnswerRe: Can two thread run the same thread function at the same time? Pin
geo_m27-Feb-05 7:51
geo_m27-Feb-05 7:51 
GeneralWhat's The Best Way... Pin
LighthouseJ27-Feb-05 3:15
LighthouseJ27-Feb-05 3:15 
GeneralRe: What's The Best Way... Pin
Blake Miller28-Feb-05 5:58
Blake Miller28-Feb-05 5:58 
GeneralRe: What's The Best Way... Pin
LighthouseJ1-Mar-05 11:11
LighthouseJ1-Mar-05 11:11 
GeneralRe: What's The Best Way... Pin
Blake Miller1-Mar-05 12:21
Blake Miller1-Mar-05 12:21 
GeneralRe: What's The Best Way... Pin
LighthouseJ1-Mar-05 14:47
LighthouseJ1-Mar-05 14:47 
GeneralRe: What's The Best Way... Pin
PJ Arends28-Feb-05 6:02
professionalPJ Arends28-Feb-05 6:02 
GeneralWinHTTP, error 12175, howto Pin
qdzhulf27-Feb-05 3:10
qdzhulf27-Feb-05 3:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.