[ECOS]A question about printf

Lewin A.R.W. Edwards larwe@larwe.com
Mon Dec 11 13:30:00 GMT 2000


Hello Andrea,

>I have a question about printf().
>I noted that if I make two consecutive call to prinf or fprintf
>functions in my executables (also a simply modified hello world program), the
>execution stops at the second function call, namely the second printf()
>doesn't works at all.

I was debugging some SmartMedia code today in eCos and noticed that the 
following code:

int i;
for (i=0;i<4096;i++) {
int k;
// some processing which assigns a value to k
printf("** Found logical block %d at physical block %d ",i, k);
}

would skip some of the last bytes of the output. However, if I added \n to 
the end of the printf format string, then all output is OK.

Looks like a buffering issue of some kind perhaps, try adding \n to the end 
of your printf strings and see if that fixes it.

=== Lewin A.R.W. Edwards (Embedded Engineer)
Work: http://www.digi-frame.com/
Personal: http://www.zws.com/ and http://www.larwe.com/



More information about the Ecos-discuss mailing list