This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Problem with f-format


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]