This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Problem with f-format
- From: Robert Brusa <bob dot brusa at gmail dot com>
- To: MailingList:ecos-discuss <ecos-discuss at ecos dot sourceware dot org>;
- Date: Wed, 20 Aug 2008 15:27:42 +0200
- Subject: [ECOS] Problem with f-format
- Reply-to: Bob dot Brusa at gmail dot com
I am using ecos on a AT91SAM7X-EK-target. The routine shown below outputs
the three lines (to UART1):
j:770 x:%f
j:
j:772 x:5.980000
which is not what I would expect from the producing routine shown here:
void fproblem( void)
{ //simple procedure to demonstrate problem with f-format
unsigned int j = 770;
float x = 5.98;
diag_printf("\nj:%u x:%f", j, x);
j++;
printf("\nj:%u x:%f", j, x);
char str[15];
j++;
sprintf(str, "\nj:%u x:%f", j, x);
diag_printf("%s", str);
} // end fproblem
I expected three identical lines. Has anybody seen similar things?
Robert
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss