![]() |
| | #1 |
| Registered User Join Date: Feb 2010 Location: Thodupuzha, Kerala, India
Posts: 3
| I am new to programming. I am trying to learn programming myself. I just set up everything using the c for dummies book and created the first goodbye program as described it it. It compiled well without any problems. DONE was the result. Now when i run the program the cmd gets killed. It doesnt even take one second on screen to get killed. I know my program is running well but cmd gets killed or just flashes out. Please advice. |
| girishkaitholil is offline | |
| | #2 |
| Registered User Join Date: Jan 2010
Posts: 18
| Hey, I assume you're working on a Windows box? Please read this FAQ entry: Cprogramming.com FAQ > Stop my Windows Console from disappearing everytime I run my program? - Andi - |
| ForzaItalia2006 is offline | |
| | #3 |
| Registered User Join Date: Jan 2010
Posts: 54
| I'm new to programming to but I think your writing a console app and the reason the program just flashes is because you have to put something in the code to keep the window open like scanf() function unless I'm totally wrong |
| artistunknown is offline | |
| | #4 |
| Registered User Join Date: Jan 2010
Posts: 54
| sorry I didn't see what the other person wrote they're right read that faqs |
| artistunknown is offline | |
| | #5 |
| Registered User Join Date: Feb 2010 Location: Thodupuzha, Kerala, India
Posts: 3
| Hey, Thank you very much.. It helped me a lot. and i have edited the c program found there to my convenience.. This is my first day of programming. And I am successful. I made it like after executing the program just a enter stroke is required to kill the cmd. I am so fascinated, Hooray, I am coding well. am I right... ! he he.. Thank you once again and the code edited by me goes like this.. insert Code:
#include <stdio.h>
void myflush ( FILE *in )
{
int ch;
do
ch = fgetc ( in );
while ( ch != EOF && ch != '\n' );
clearerr ( in );
}
void mypause ( void )
{
printf ( "Press [Enter] to continue . . ." );
fflush ( stdout );
getchar();
}
int main ( void )
{
int number;
// Test with an empty stream
printf ( "Hello, world!\n" );
mypause();
}
|
| girishkaitholil is offline | |
| | #6 |
| Registered User Join Date: Feb 2010 Location: Thodupuzha, Kerala, India
Posts: 3
| I really dont know what the above code is.. but some part, my intuition told me "edit." i edited. it worked for me. Thank you Andy.. |
| girishkaitholil is offline | |
![]() |
| Tags |
| cmd gets killed |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C window code - How easy is it to intergrate cmd code | spadez | C Programming | 23 | 04-20-2009 07:35 AM |
| OOP Question DB Access Wrapper Classes | digioz | C# Programming | 2 | 09-07-2008 04:30 PM |
| Error running program in cmd - cygwin.dll missing - | JFonseka | C Programming | 5 | 08-27-2007 12:12 PM |
| Converting cmd arg to int | InstaDeath | C++ Programming | 5 | 03-17-2004 09:45 PM |
| Little help with CMD | robid1 | C Programming | 2 | 02-23-2003 04:09 AM |