c - execl & printf - order -


i have small problem this:

{   printf ("abc");   execl("./prog","prog",null); } 

all works fine, why execl run before printf? me?

the printf run first, it's output buffered.

you can flush buffer either adding newline (\n) end of string or calling fflush(stdout):

 printf("abc\n"); 

or:

printf("abc"); fflush(stdout); 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -