printf: string precision "%.*s" give (null) string
Peter Lukac
p.lukac at emtest.sk
Fri Nov 6 15:15:14 UTC 2009
Hello,
I use uclibc version 0.9.29 on arm.
I think that function printf not work right with precision for string.
here is my simple program:
#include <stdio.h>
int main()
{
char *p = NULL;
printf("\n--->%.*s<---", 0, p);
printf("\n--->%.*s<---", 3, p);
printf("\n--->%.*s<---\n", 6, p);
return 0;
}
on glibc it works fine. i get output :
---><---
---><---
--->(null)<---
but in uclibc i get
--->(null)<---
--->(null)<---
--->(null)<---
I think that if precision .* parameter is 0 or is less as string length,
printf should be print empty string "" and not "(null)" string.
Is it bug or feature? :)
i'm using pjlib where is used lot of code with "%.*s" argument which don't
work correctly.
...have a nice day
More information about the uClibc
mailing list