IT Community - Software Programming, Web Development and Technical Support

when the program is executing,how to stop the program and open the cmd window...

This is a discussion on when the program is executing,how to stop the program and open the cmd window... within the C# Programming forums, part of the Software Development category; when the program is executing, how to stop the program and open the cmd window thru the application itself ? (In ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C# Programming

Register FAQ Members List Calendar Mark Forums Read
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 07-25-2007, 05:50 AM
bluesky bluesky is offline
D-Web Analyst
 
Join Date: Jun 2007
Posts: 201
bluesky is on a distinguished road
Question when the program is executing,how to stop the program and open the cmd window...

when the program is executing, how to stop the program and open the cmd window thru the application itself ? (In C#)
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-25-2007, 05:51 AM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 882
kingmaker is on a distinguished road
Send a message via Yahoo to kingmaker
Default Re: when the program is executing,how to stop the program and open the cmd window...

Use the System.Console class to read and write to the StdIn/StdOut/StdError streams. Make sure your project type is set to Console Application, and then use Console.Read() or Console.ReadLine() to read input from the command window. These calls are synchronous and will block execution of your application until they return. This will provide the effect you are after if you want the console window to remain open until your data has been input from the command window. Try this inside of your application. Start a new console application in C# and paste this code over the stock Main method.


static void Main(string[] args)
{
// read the ASCII value of the char typed and cast it to a char value
char ch = (char)Console.Read();

// read the ASCII value of the char typed

int asciiCode = Console.Read();

// read the input data until a return or new line is read
// this allows the user to type away until they press enter/return
// this method will return you information one line at a time...
string line = Console.ReadLine();
}
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/c-programming/2756-when-program-executing-how-stop-program-open-cmd-window.html
Posted By For Type Date
Programming This thread Refback 07-25-2007 06:45 AM

Similar Threads
Thread Thread Starter Forum Replies Last Post
open a new window using php code gk_cloud PHP Programming 3 03-26-2008 09:08 PM
How to open a file with its default program Manikandan.S ASP and ASP.NET Programming 2 03-10-2008 10:04 PM
How to launch Real Player program through my j2me midlet program? itbarota J2ME 1 07-25-2007 11:39 PM
How can I find out the name of the namespace which a program is currently executing? kingmaker C# Programming 1 07-22-2007 11:32 PM
IE7: What is the Code open window in a ' montyauto HTML, CSS and Javascript Coding Techniques 4 03-27-2007 11:07 AM


All times are GMT -7. The time now is 11:15 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0