Thread overview
Stoping VS2005 from closing the damn console window
Apr 09, 2009
Andrej M.
Apr 09, 2009
Adam D. Ruppe
Apr 09, 2009
torhu
Apr 09, 2009
Denis Koroskin
Apr 09, 2009
Kagamin
Apr 09, 2009
Andrej M
April 09, 2009
I'm trying to get VS 2005 to stop closing the command window when I'm running examples from the "Learn to tango with D" book. (I'm using that VS plugin from Dsource.org)

I've tried running the examples with and without debugging, but the command window still closes down rapidly.

I've even tried using a function to wait for user input.. but that won't work either. I've no idea what's going on. Here's a peace of code I've tried:

[code]
import tango.io.Console;

void main()
{
Cout ("What is your name? ") ();
auto name = Cin.get();

Cout ("Hello ") (name).newline;
}
[/code]



April 09, 2009
On Thu, 09 Apr 2009 12:53:12 -0400, Andrej M. <and.mitrovic@hotmail.com> wrote:

> I'm trying to get VS 2005 to stop closing the command window when I'm running examples from the "Learn to tango with D" book. (I'm using that VS plugin from Dsource.org)
>
> I've tried running the examples with and without debugging, but the command window still closes down rapidly.
>
> I've even tried using a function to wait for user input.. but that won't work either. I've no idea what's going on. Here's a peace of code I've tried:
>
> [code]
> import tango.io.Console;
>
> void main()
> {
> Cout ("What is your name? ") ();
> auto name = Cin.get();
>
> Cout ("Hello ") (name).newline;
> }
> [/code]


Try Thread.sleep(3600);

That will sleep for an hour :)

Of course, you'll have to kill it to stop it.

You can also always simply run cmd.exe and run it from the command line.

-Steve
April 09, 2009
On Thu, Apr 09, 2009 at 12:53:12PM -0400, Andrej M. wrote:
> I'm trying to get VS 2005 to stop closing the command window when I'm running examples from the "Learn to tango with D" book. (I'm using that VS plugin from Dsource.org)

Stick another Cin.get(); at the end of the code. That way, it will pause
for you to press another key before terminating, giving you a chance
to look over the output.

I think there is an option in the console window to keep it open too, somewhere in right click its taskbar icon, hit edit->properties and look under those tabs for the checkbox, but I'm not sure if that is actually there anymore.

Just getting another line of user input at the end of the program will work though.


-- 
Adam D. Ruppe
http://arsdnet.net
April 09, 2009
On 09.04.2009 18:53, Andrej M. wrote:
> I'm trying to get VS 2005 to stop closing the command window when I'm running examples from the "Learn to tango with D" book. (I'm using that VS plugin from Dsource.org)
>
> I've tried running the examples with and without debugging, but the command window still closes down rapidly.
>
> I've even tried using a function to wait for user input.. but that won't work either. I've no idea what's going on. Here's a peace of code I've tried:
>
> [code]
> import tango.io.Console;
>
> void main()
> {
> Cout ("What is your name? ") ();
> auto name = Cin.get();
>
> Cout ("Hello ") (name).newline;
> }
> [/code]
>
>
>

Doesn't it wait for input if you just add an extra Cin.get() at the end?
April 09, 2009
On Thu, 09 Apr 2009 20:53:12 +0400, Andrej M. <and.mitrovic@hotmail.com> wrote:

> I'm trying to get VS 2005 to stop closing the command window when I'm running examples from the "Learn to tango with D" book. (I'm using that VS plugin from Dsource.org)
>
> I've tried running the examples with and without debugging, but the command window still closes down rapidly.
>
> I've even tried using a function to wait for user input.. but that won't work either. I've no idea what's going on. Here's a peace of code I've tried:
>
> [code]
> import tango.io.Console;
>
> void main()
> {
> Cout ("What is your name? ") ();
> auto name = Cin.get();
>
> Cout ("Hello ") (name).newline;
> }
> [/code]
>
>
>

Try running your applications using Ctrl+F5, this should help.
April 09, 2009
cmd /K myprog.exe
April 09, 2009
Yeah it's Cin.get(); that did the trick.

Thanks everyone.