[Tinyos-devel] Re: [Tinyos-help] Question about printf

Philip Levis pal at cs.stanford.edu
Fri Sep 21 19:35:54 PDT 2007


On Sep 21, 2007, at 5:56 PM, Michael Schippling wrote:

> Does 'regular' printf() guarantee that now?
> I remember having to do fflush() if I really wanted to see something.

C stdlib printf(3) does not always block. But it can block, and you  
can make it block on flushing the buffer.[1]  This might seem like a  
little nit, but it can bite you. E.g.:

call Foo.x();
printf("Got past Foo.x()\n");
call Foo.y();
printf("Got past Foo.y()\n");

Phil

[1] http://books.google.com/books? 
id=iRa-3L4jLhEC&pg=PA84&lpg=PA84&dq=printf+flush+newline 
+buffer&source=web&ots=dWntcq9i9J&sig=_r66dlfabrAEkJ8ltMzuRLysKj4


More information about the Tinyos-devel mailing list