Click here to Skip to main content
15,915,852 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to compare stderr to stdout Pin
DQNOK2-Jun-08 10:26
professionalDQNOK2-Jun-08 10:26 
QuestionRe: How to compare stderr to stdout Pin
David Crow2-Jun-08 11:01
David Crow2-Jun-08 11:01 
AnswerRe: How to compare stderr to stdout Pin
DQNOK2-Jun-08 11:11
professionalDQNOK2-Jun-08 11:11 
AnswerRe: How to compare stderr to stdout Pin
Nibu babu thomas2-Jun-08 17:11
Nibu babu thomas2-Jun-08 17:11 
GeneralRe: How to compare stderr to stdout Pin
DQNOK3-Jun-08 3:22
professionalDQNOK3-Jun-08 3:22 
GeneralRe: How to compare stderr to stdout Pin
DQNOK3-Jun-08 8:43
professionalDQNOK3-Jun-08 8:43 
AnswerRe: How to compare stderr to stdout Pin
maxie20052-Jun-08 19:12
maxie20052-Jun-08 19:12 
GeneralRe: How to compare stderr to stdout Pin
DQNOK3-Jun-08 3:17
professionalDQNOK3-Jun-08 3:17 
I like that idea.

But this needs to be general. It's an "alert" library (a very minature logging library) that needs to detect on its own whether stderr has already been redirected.

Key idea: *auto-detect* where stderr is outputting to, and if it's going to stdout, skip over the requirement to write to stderr.

  vprintf( alertMsg, msgArgs );             //print to stdout
  if( stdout != stderr )
     vfprintf( stderr, alertMsg, msgArgs ); //print to stderr
//otherwise, already printed to stderr.  Just move on.
  ...

(Note: code is not complete; it needs some complicating va_end and va_starts in there to make it work correctly. Don't use it as a model!)

David
---------
Empirical studies indicate that 20% of the people drink 80% of the beer. With C++ developers, the rule is that 80% of the developers understand at most 20% of the language. It is not the same 20% for different people, so don't count on them to understand each other's code.
http://yosefk.com/c++fqa/picture.html#fqa-6.6

---------

Question'LONG' to 'int' [modified] Pin
Queeny2-Jun-08 10:14
Queeny2-Jun-08 10:14 
QuestionRe: 'LONG' to 'int' Pin
Mark Salsbery2-Jun-08 10:25
Mark Salsbery2-Jun-08 10:25 
AnswerRe: 'LONG' to 'int' Pin
Queeny2-Jun-08 14:43
Queeny2-Jun-08 14:43 
GeneralRe: 'LONG' to 'int' Pin
Mark Salsbery3-Jun-08 4:58
Mark Salsbery3-Jun-08 4:58 
AnswerRe: 'LONG' to 'int' Pin
DQNOK2-Jun-08 10:36
professionalDQNOK2-Jun-08 10:36 
AnswerRe: 'LONG' to 'int' Pin
Kwanalouie2-Jun-08 14:58
Kwanalouie2-Jun-08 14:58 
AnswerRe: 'LONG' to 'int' Pin
Akt_4_U2-Jun-08 20:44
Akt_4_U2-Jun-08 20:44 
QuestionChar * to wstring conversion Pin
jinbabaj2-Jun-08 7:37
jinbabaj2-Jun-08 7:37 
QuestionRe: Char * to wstring conversion Pin
David Crow2-Jun-08 7:56
David Crow2-Jun-08 7:56 
AnswerRe: Char * to wstring conversion Pin
Nemanja Trifunovic2-Jun-08 8:33
Nemanja Trifunovic2-Jun-08 8:33 
AnswerRe: Char * to wstring conversion Pin
Nemanja Trifunovic2-Jun-08 8:30
Nemanja Trifunovic2-Jun-08 8:30 
QuestionHow to get the file icon and insert to listctrl? Pin
york5282-Jun-08 7:07
york5282-Jun-08 7:07 
AnswerRe: How to get the file icon and insert to listctrl? Pin
Jijo.Raj2-Jun-08 7:34
Jijo.Raj2-Jun-08 7:34 
GeneralRe: How to get the file icon and insert to listctrl? Pin
york5282-Jun-08 23:31
york5282-Jun-08 23:31 
AnswerRe: How to get the file icon and insert to listctrl? Pin
Hamid_RT3-Jun-08 1:28
Hamid_RT3-Jun-08 1:28 
AnswerRe: How to get the file icon and insert to listctrl? Pin
Hamid_RT3-Jun-08 1:31
Hamid_RT3-Jun-08 1:31 
GeneralRe: How to get the file icon and insert to listctrl? Pin
york5283-Jun-08 2:38
york5283-Jun-08 2:38 

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.