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 ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| 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(); } |
![]() |
| Thread Tools | |
| Display Modes | |
| |
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 |