Little Window that Pops up for 'cout' Output

K

KevinSimonson

I'm a relative newcomer to Visual Studio. I brought it up and typed
in a very simple program:

#include "stdafx.h"
#include <iostream>
using namespace std;

int _tmain( int argc
, _TCHAR* argv[])
{
cout << "Hello world!" << endl;
return 0;
}

When I click on <Debug->Start Without Debugging>, a little window
comes up that says, "Hello world!" One line below it it says, "Press
any key to continue . . ."

I've also got another piece of code, that I got from an open source
project, and my boss wanted me to add some functionality to it. I
added the functionality and told my boss, and he asked me to modify
the code so that it print out the results my new code was generating.
Basically I'm doing a search for files that match a group of
keywords. So I put code in that said,
'cout << "Searching for a file with keywords \"" << strText << "\"."
<< endl;' at the point where I start the search, and I put code in
that said, 'cout << "Search found file \"" << pHits->m_sName << "\"."
<< endl;' at the point where the search starts to yield results.

Then I clicked on <Debug->Start Without Debugging>, and no little
window came up to display either of these two outputs. I also clicked
on <Debug->Start Debugging> and verified that execution does indeed go
to at least the first 'cout' command. What am I doing differently
about this open source project than I am doing with the simple "Hello
World" project up above? Is there a setting the open source project
might be set to that keeps windows from coming up for the output of
'cout' commands? If so, how do I set the open source project brings
up a little window for the output of 'cout' commands?

I posted this to "microsoft.public.vstudio.development", but it's been
two or three hours now and I haven't gotten a response, so I thought
I'd try this forum.

Kevin S
 
I

Ian Collins

I'm a relative newcomer to Visual Studio. I brought it up and typed
in a very simple program:

#include "stdafx.h"
#include<iostream>
using namespace std;

int _tmain( int argc
, _TCHAR* argv[])

There are a number of groups dedicated to windows programming and Visual
Studio, this questions belongs on one of those.
I posted this to "microsoft.public.vstudio.development", but it's been
two or three hours now and I haven't gotten a response, so I thought
I'd try this forum.

Usenet isn't an IM service!
 
B

Bo Persson

Paavo said:
(e-mail address removed):


There are different types of Windows programs, some using a console
window, some not. Generally the end user does not want to see the
old-style "DOS box" (even though it can be easily adjusted to be
larger and in better colors), so standard Windows programs do not
use a console window.

For test output I would suggest to write it to a disk file instead.

Or look for the AllocConsole function. The debugger obviously calls
that for you for some kinds programs, but not for others.


Bo Persson
 

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

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top