Fixed decimal printing
git-svn-id: http://picoc.googlecode.com/svn/trunk@12 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
ead3f08671
commit
553e501460
7
str.c
7
str.c
|
@ -35,7 +35,8 @@ int StrEqualC(const Str *Str1, const char *Str2)
|
||||||
void StrPrintInt(int Num, FILE *Stream)
|
void StrPrintInt(int Num, FILE *Stream)
|
||||||
{
|
{
|
||||||
int Div;
|
int Div;
|
||||||
int Remainder;
|
int Remainder = 0;
|
||||||
|
int Printing = FALSE;
|
||||||
|
|
||||||
if (Num < 0)
|
if (Num < 0)
|
||||||
{
|
{
|
||||||
|
@ -51,7 +52,11 @@ void StrPrintInt(int Num, FILE *Stream)
|
||||||
while (Div > 0)
|
while (Div > 0)
|
||||||
{
|
{
|
||||||
Remainder = Num / Div;
|
Remainder = Num / Div;
|
||||||
|
if (Printing || Remainder > 0)
|
||||||
|
{
|
||||||
fputc('0' + Remainder, Stream);
|
fputc('0' + Remainder, Stream);
|
||||||
|
Printing = TRUE;
|
||||||
|
}
|
||||||
Num -= Remainder * Div;
|
Num -= Remainder * Div;
|
||||||
Div /= 10;
|
Div /= 10;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue