On May 13, 1:44 pm, li...@eitanadler.com (Eitan Adler) wrote: > > The C programme looks like this (very simple) > > #include <stdio.h> > > int main() > > { > > int i; > > char s[20] = "hello from c"; > > for (i = 0; i < 15; i++) { > > sleep(1); > > printf("%s %d\n", s, i); > > } > > return 0; > > } > > and yet I only get the output to perl when it is finished and died. > > Thanks, > > You get multiple levels of output buffering: > 1) C does its own output buffering. Take a look at man setvbuf(1) > 2) The operating system buffer which is entirely different than the C buffer > You need to disable both of them to get fully unbuffered output
You could also call fflush(stdout); after the printf function. http://www.thinkage.ca/english/gcos/expl/nsc/lib/fflush.html -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/