|
From: Duong Ha N. <nha...@gm...> - 2007-08-22 01:23:14
|
Hi,
I used to write code like that to pause my program to see the result or
debug,
#include <stdio.h>
int main()
{
printf("Hello World\n");
scanf("\n"); // <-- Add this line only
return 0;
}
To make it continue to run again I just type any character and press
"Enter".
Good luck.
2007/8/22, Adam Jones <aj...@i-...>:
>
> The flash you see is the win console window opening and closing. You have
> to
> stop or pause the program execution to see the output. You can do it as
> others have said:
>
> >> Try using a DOS prompt to execute the same file and see what happens.
>
> Or you can use a system call to pause the execution. See your updated code
> below:
>
> #include <stdio.h>
> #include <stdlib.h> //<== Add this line to your code
>
> int main()
> {
> printf("Hello World\n");
>
> system("pause"); //<== Add this line to your code
> return 0;
> }
>
> Please no lectures on the evils of system("pause"). We have been thru that
> on this list before... Warning: don't use system("pause") in production
> code.....
>
> -Adam Jones
>
>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|