www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Stoping VS2005 from closing the damn console window

reply Andrej M. <and.mitrovic hotmail.com> writes:
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]
Apr 09 2009
next sibling parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
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
Apr 09 2009
prev sibling next sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
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
Apr 09 2009
prev sibling next sibling parent torhu <no spam.invalid> writes:
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?
Apr 09 2009
prev sibling next sibling parent "Denis Koroskin" <2korden gmail.com> writes:
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.
Apr 09 2009
prev sibling parent reply Kagamin <spam here.lot> writes:
cmd /K myprog.exe
Apr 09 2009
parent Andrej M <and.mitrovic hotmail.com> writes:
Yeah it's Cin.get(); that did the trick.

Thanks everyone.
Apr 09 2009