472,348 Members | 1,538 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,348 software developers and data experts.

Where does fprintf(stderr, ..) go to?

Sorry if this is a trivial question :-)

I've got several print statements in my code:

fprintf ( stderr, ....);

but when I run my program, I cannot find the output text in any window.

My program is in Visual C++. The program is windows-based (not a
command-line program. The program is not managed. I'm running within the
Visual C++ debugger. I've tried displaying every Vis C++ window, including
the "Output" window, but the fprintf() text does not appear there.

What window contains the fprintf(stderr) text (when running in the debugger)?

Nov 17 '05 #1
2 3535
"noleander" <no*******@discussions.microsoft.com> wrote in message
news:3D**********************************@microsof t.com...
Sorry if this is a trivial question :-)

I've got several print statements in my code:

fprintf ( stderr, ....);

but when I run my program, I cannot find the output text in any window.

My program is in Visual C++. The program is windows-based (not a
command-line program. The program is not managed. I'm running within
the
Visual C++ debugger. I've tried displaying every Vis C++ window,
including
the "Output" window, but the fprintf() text does not appear there.

What window contains the fprintf(stderr) text (when running in the
debugger)?


Windows programs do not have consoles by default. Consoles are the devices
to which stdout and stderr are usually wired. Catch 22.

If you want to see output in the debugger you can use OutputDebugString().

If you want a console for debugging your windows applications you can do
this:

FILE *fp;
HANDLE hCon;

// Allocate a console

AllocConsole();

// And make printf happy

hCon = GetStdHandle(STD_OUTPUT_HANDLE);

fd = _open_osfhandle(reinterpret_cast<long>(hCon), 0);
fp = _fdopen(fd, "w");

*stdout = *fp;
setvbuf(stdout, NULL, _IONBF, 0);

Regards,
Will
Nov 17 '05 #2
Thanks for the prompt and accurate reply.

Using OutputDebugString() works perfectly for me!
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: clusardi2k | last post by:
/* The below code on SGI will wait for you to enter 2 things, but on Linux it will only wait the first time. I can make the code work by...
5
by: L. Westmeier | last post by:
Reading the man pages and some code did not really help me in understanding the difference between - or better when I should use - perror("...")...
3
by: Andrew Fabbro | last post by:
I have code with stuff like this all over it: sprintf(errmsg,"somefunc(): %s has illegal character %c",somestring,somechar);...
1
by: David Resnick | last post by:
I had a problem going from gcc 2.96 to gcc 3.2.3 and narrowed it down to the following code. The question is whether the problem is undefined...
7
by: jchludzinski | last post by:
I tryin' to print out a string with a variable number of blanks/spaces preceding the string. I know that if I use: fprintf( stdout, "%12s",...
89
by: Cuthbert | last post by:
After compiling the source code with gcc v.4.1.1, I got a warning message: "/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the...
18
by: praetor.michael | last post by:
I have a DLL written in C that writes to stderr. I have a win32 console application that makes calls to the DLL. In the console app I redirect...
6
by: Chad | last post by:
When the following functions takes the string "this is a string" static void *build_string(char *s) { int k; char *start; size_t len; size_t...
45
by: loudking | last post by:
Hello, all I don't quite understand what does ((time_t)-1) mean when I execute "man 2 time" RETURN VALUE On success, the value of time in...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.