Re: execl!

Kev (klmitch@mit.edu)
Wed, 24 Mar 1999 09:02:06 EST


> Have a look at this piece of code.
> The instructions prior to the execl() function is not getting executed.
> When I give a getchar() after the printf statement then the "Tr -module"
> is getting printed.
> From the manpage, what I had understood is that the execl function
> replaces the current process image with the new process image.
> But, Does it replaces the prior instructions also? or what is happening??

nope, stdio is buffering. If you make that "Tr -module\n", it'll magically
work; another alternative is an explicit fflush(). getchar() makes this
work because it forces stdio to flush the buffer so it can use it for
input.

-- 
Kevin L. Mitchell <klmitch@mit.edu>
-------------------------  -. .---- --.. ..- -..-  --------------------------
http://web.mit.edu/klmitch/www/               (PGP keys availiable from here)
    RSA AE87D37D/1024:  DE EA 1E 99 3F 2B F9 23  A0 D8 05 E0 6F BA B9 D2
    DSS ED0DB34E/1024: D9BF 0E74 FDCB 43F5 C597  878F 9455 EC24 ED0D B34E
    DH  2A2C31D4/2048: 1A77 4BA5 9E32 14AE 87DA  9FEC 7106 FC62 2A2C 31D4

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/