By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,234 Members | 1,941 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,234 IT Pros & Developers. It's quick & easy.

printout statements

P: n/a
Hello all,
I have a C++ program written as a CWinApp which compiles but somewhere
has an error. I use the visual studio .NET compiler by the way. I am
use to programs written in unix environment. Because the program has an
error I want to use print out statements using cout to check values of
my variables. But the problem is that I do not have a console where it
prints out the value. How do I check now the value ??? Thank you in
advance for your help.
Robert

Jul 23 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
wo*********@yahoo.com wrote:
Hello all,
I have a C++ program written as a CWinApp which compiles but somewhere
has an error. I use the visual studio .NET compiler by the way. I am
use to programs written in unix environment. Because the program has
an error I want to use print out statements using cout to check
values of my variables. But the problem is that I do not have a
console where it prints out the value. How do I check now the value
??? Thank you in advance for your help.


You will need to ask this question in a forum dedicated to your Windows
compiler. Here only the C++ language itself is discussed, which does not
cover those special issues of Windows programs. If you go to the Microsoft
web site and look for the newsgroups, you will find many there.

--
Attila aka WW
Jul 23 '05 #2

P: n/a
wo*********@yahoo.com wrote:
I have a C++ program written as a CWinApp which compiles but somewhere
has an error. I use the visual studio .NET compiler by the way. I am
use to programs written in unix environment. Because the program has an
error I want to use print out statements using cout to check values of
my variables. But the problem is that I do not have a console where it
prints out the value. How do I check now the value ???


Use 'OutputDebugString' together with 'sprintf', the string will be output
to the debugger window (RTFM on it). And questions on debugging Windows
applications are better asked in a Windows programming newsgroup (like
comp.os.ms-windows.programmer.win32). Here such questions are off-topic.

V
Jul 23 '05 #3

P: n/a
wo*********@yahoo.com wrote:
Hello all,
I have a C++ program written as a CWinApp which compiles but somewhere
has an error. I use the visual studio .NET compiler by the way. I am
use to programs written in unix environment. Because the program has an
error I want to use print out statements using cout to check values of
my variables. But the problem is that I do not have a console where it
prints out the value.
Why don't you have one?
How do I check now the value ???
Redirect the output to a file. Under linux, you can do:

../myprogram > file

to write the result into a file. Or you can instead of to cout write it into
an fstream within your program.
Thank you in advance for your help.

Jul 23 '05 #4

P: n/a
"wo*********@yahoo.com" wrote:

Hello all,
I have a C++ program written as a CWinApp which compiles but somewhere
has an error. I use the visual studio .NET compiler by the way. I am
use to programs written in unix environment. Because the program has an
error I want to use print out statements using cout to check values of
my variables. But the problem is that I do not have a console where it
prints out the value. How do I check now the value ??? Thank you in
advance for your help.
Robert


Technically you are off-topic because your question is related
to how a specific compiler under a specific operating system works.
So next time ask in a Windows programming group.

However:
* Visual Studio comes with a good debugger. You should not have
problems to use that. The debugger can show any variable.
Just position the caret on the variable, right click and select
'Quick View' (That's how it worked under VC++ 6.0, but I guess
.NET is not much different)

* When you have your debugger running, check out the TRACE macro
This comes in handy, if you regularily need to output great amounts
of debug data.

* If all else fails, you can always use MessageBoxes to pop up
a quick and dirty output dialog.

--
Karl Heinz Buchegger
kb******@gascad.at
Jul 23 '05 #5

P: n/a
wo*********@yahoo.com wrote:
Hello all,
I have a C++ program written as a CWinApp which compiles but somewhere
has an error. I use the visual studio .NET compiler by the way. I am
use to programs written in unix environment. Because the program has an
error I want to use print out statements using cout to check values of
my variables. But the problem is that I do not have a console where it
prints out the value. How do I check now the value ??? Thank you in
advance for your help.
Robert


Try outputting your messages to a text file.
This will also show the messages in the order they
were executed and you don't have to mess with any
extra windowing stuff.

And sending text to a text file is _standard_
C++. :-)

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library

Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.