H
Henryk
Hey there,
I have some problems with the following code snippet on a Virtex-4
PowerPC with a GCC based compiler
char chData[6];
sprintf(&chData[0], "%+05.0f", -0.038f); --> I get "-000" ???
sprintf(&chData[0], "%+05.0f", -0.380f); --> I get "-000" ???
sprintf(&chData[0], "%+05.0f", -3.800f); --> I get "-0004" ok
sprintf(&chData[0], "%+05.0f", +0.038f); --> I get "+000" ???
sprintf(&chData[0], "%+05.0f", +0.380f); --> I get "+000" ???
sprintf(&chData[0], "%+05.0f", +3.800f); --> I get "+0004" ok
I would expect to get always a string with the length of 5 but
sometimes I get only 4 chars back. Is this a compiler bug?
In Visual Studio I get always 5 chars back.
Thank you
Henryk
I have some problems with the following code snippet on a Virtex-4
PowerPC with a GCC based compiler
char chData[6];
sprintf(&chData[0], "%+05.0f", -0.038f); --> I get "-000" ???
sprintf(&chData[0], "%+05.0f", -0.380f); --> I get "-000" ???
sprintf(&chData[0], "%+05.0f", -3.800f); --> I get "-0004" ok
sprintf(&chData[0], "%+05.0f", +0.038f); --> I get "+000" ???
sprintf(&chData[0], "%+05.0f", +0.380f); --> I get "+000" ???
sprintf(&chData[0], "%+05.0f", +3.800f); --> I get "+0004" ok
I would expect to get always a string with the length of 5 but
sometimes I get only 4 chars back. Is this a compiler bug?
In Visual Studio I get always 5 chars back.
Thank you
Henryk