printout statements

W

wongjoekmeu

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
 
A

Attila Feher

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.
 
V

Victor Bazarov

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
 
R

Rolf Magnus

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.
 
K

Karl Heinz Buchegger

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.
 
T

Thomas Matthews

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top