The console windows disappears 
Author Message
 The console windows disappears

Hi, everyone,

In VC6 I write a console application, say:

#include <iostream.h>
int main () {
cout << "Hello\n";
return 0;

Quote:
}

When I run it from the VC environment IDE a
console window is displayed with the output
of the program:

Hello
Press any key to continue

However in VC7, the console window is
displayed and disappears so quickly that
I can't see the program output.

Anyone knows how to keep the console window
when run a console program from VC7 IDE?

Thanks a lot

Yuelin



Thu, 27 May 2004 00:42:48 GMT  
 The console windows disappears
Yuelin,

Quote:
> When I run it from the VC environment IDE a
> console window is displayed with the output
> of the program:

> Hello
> Press any key to continue

> However in VC7, the console window is
> displayed and disappears so quickly that
> I can't see the program output.

Funny... It works just fine for me. What build of VS.NET and on what OS are
you running?

--
Tomas Restrepo



Thu, 27 May 2004 01:13:49 GMT  
 The console windows disappears
Hi, thanks for the message.

I am using VC7 Beta 2 (Visual Studio.NET beta 2) on Win2k
Yuelin

Quote:
>-----Original Message-----
>Yuelin,

>> When I run it from the VC environment IDE a
>> console window is displayed with the output
>> of the program:

>> Hello
>> Press any key to continue

>> However in VC7, the console window is
>> displayed and disappears so quickly that
>> I can't see the program output.

>Funny... It works just fine for me. What build of VS.NET
and on what OS are
>you running?

>--
>Tomas Restrepo

>.



Thu, 27 May 2004 01:31:05 GMT  
 The console windows disappears
Yuelin,

Quote:
> I am using VC7 Beta 2 (Visual Studio.NET beta 2) on Win2k
> Yuelin

humm... I don't remember having that problem with beta 2, and I ran it quite
a  bit on Win2k... perhaps it is something particular in your configuration
that's giving you trouble? But beats me what it might be, right now...

As I said, I'm running an RC build on XP Pro, and it works just
dandy....Perhaps someone of the MS guys covering the IDE or project system
could chime in and see if they have a better idea...

--
Tomas Restrepo



Thu, 27 May 2004 02:28:10 GMT  
 The console windows disappears
Yuelin, Tomas,
Isn't that the normal behavior when you start a Console application from within the IDE (debug - start)
, a shell get's spawned, Hello is output to the console and when the app. exits the shell exits as well.
Or am I drunk :-)

Willy.

Quote:

> Yuelin,

> > I am using VC7 Beta 2 (Visual Studio.NET beta 2) on Win2k
> > Yuelin

> humm... I don't remember having that problem with beta 2, and I ran it quite
> a  bit on Win2k... perhaps it is something particular in your configuration
> that's giving you trouble? But beats me what it might be, right now...

> As I said, I'm running an RC build on XP Pro, and it works just
> dandy....Perhaps someone of the MS guys covering the IDE or project system
> could chime in and see if they have a better idea...

> --
> Tomas Restrepo




Thu, 27 May 2004 05:10:07 GMT  
 The console windows disappears
Willy,

Quote:
> Isn't that the normal behavior when you start a Console application from

within the IDE (debug - start)
Quote:
> , a shell get's spawned, Hello is output to the console and when the app.

exits the shell exits as well.

Quote:
> Or am I drunk :-)

Ahh, but I'm not talking about Debug->Start here, but about run (commonly
known as Ctrl-F5) :)

--
Tomas Restrepo



Thu, 27 May 2004 06:00:46 GMT  
 The console windows disappears
Hey Tomas,

Sure, but maybe Yuelin, is using F5, He didn't mention run (CTRL-F5).

Willy.

Quote:

> Willy,

> > Isn't that the normal behavior when you start a Console application from
> within the IDE (debug - start)
> > , a shell get's spawned, Hello is output to the console and when the app.
> exits the shell exits as well.
> > Or am I drunk :-)

> Ahh, but I'm not talking about Debug->Start here, but about run (commonly
> known as Ctrl-F5) :)

> --
> Tomas Restrepo




Thu, 27 May 2004 17:17:23 GMT  
 The console windows disappears
Hi Willy,

Quote:
> Sure, but maybe Yuelin, is using F5, He didn't mention run (CTRL-F5).

Well, he mentioned it stoped in VC6, so I just assumed it had to be run,
since it has never stoped in debug mode unless you put a breakpoint there :)

--
Tomas Restrepo



Thu, 27 May 2004 21:20:06 GMT  
 The console windows disappears
Hi Tomas,

Agreed, I guess the only one to answer the question is the original poster.

Willy.

Quote:

> Hi Willy,

> > Sure, but maybe Yuelin, is using F5, He didn't mention run (CTRL-F5).

> Well, he mentioned it stoped in VC6, so I just assumed it had to be run,
> since it has never stoped in debug mode unless you put a breakpoint there :)

> --
> Tomas Restrepo




Thu, 27 May 2004 23:34:21 GMT  
 The console windows disappears
Hi Yuelin,
How are you running the application in VC6? Are you using Ctrl+F5 or just
F5?

From the application below, once the console out (cout) is executed the
console window closes. Only if you step through the application using F11
will you see the console window remain open and you can follow the
locals/watch variables.

--
regards,
Robert Svilpa
Software Design Engineer in Test
Managed Extensions for C++
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. ? 2001 Microsoft Corporation. All rights
reserved.


Quote:
> Hi, everyone,

> In VC6 I write a console application, say:

> #include <iostream.h>
> int main () {
> cout << "Hello\n";
> return 0;
> }

> When I run it from the VC environment IDE a
> console window is displayed with the output
> of the program:

> Hello
> Press any key to continue

> However in VC7, the console window is
> displayed and disappears so quickly that
> I can't see the program output.

> Anyone knows how to keep the console window
> when run a console program from VC7 IDE?

> Thanks a lot

> Yuelin



Mon, 31 May 2004 03:56:25 GMT  
 The console windows disappears
Add this line as the last line of your code...

Console.ReadLine();

Now your application will wait for you to tap the <Enter> key in order to
read a line of input, thus leaving your console application window open.

Gary


Quote:
> Hi, everyone,

> In VC6 I write a console application, say:

> #include <iostream.h>
> int main () {
> cout << "Hello\n";
> return 0;
> }

> When I run it from the VC environment IDE a
> console window is displayed with the output
> of the program:

> Hello
> Press any key to continue

> However in VC7, the console window is
> displayed and disappears so quickly that
> I can't see the program output.

> Anyone knows how to keep the console window
> when run a console program from VC7 IDE?

> Thanks a lot

> Yuelin



Mon, 31 May 2004 14:02:59 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. Help: Console window disappears immediately when running in VS.net IDE

2. disappearing output window with console app

3. Disappearing Console?

4. Q: Console Disappear

5. Windows disappearing from the Window menu

6. Starting a console application without the console window

7. Building a Console Program without the Console Window (HELP)

8. clear console screen, and sleep() functions in the console window

9. how to use a console window in a win32 application..-- not console application

10. Console o/p from windows application (not in new console)

11. Windows.Forms ugly console window

12. Window's Console window (where is stdout)

 

 
Powered by phpBB® Forum Software