Page 1 of 1

sprintf

Posted: Sun Nov 04, 2012 9:58 pm
by vrozos
I think there is a problem with sprintf.

int le=1;
char strng[40];

sprintf(strng, "%d", le);
printf("LE=%d LE=%s\n", le, strng);

I get
LE=1 LE=15

V.

Re: sprintf

Posted: Sun Nov 04, 2012 10:13 pm
by vrozos
I think OSDK sprintf puts the null-terminator always at position 4 even if the integer has only 1 digit.

V.

Re: sprintf

Posted: Sun Nov 04, 2012 11:17 pm
by Dbug
The complete code of the osdk is in the /lib folder, sprintf is implemented in "printf.s" but also rely on conversions from "itoa" and other functions.
Possibly the issue is in itoa.