Page 1 of 1

Problems Printing Integers

Posted: Fri Nov 29, 2002 3:55 am
by M@rtyn12345
[attachment deleted by admin]

Re:Problems Printing Integers

Posted: Fri Nov 29, 2002 6:26 am
by Tim
What's this "%i" format? Use "%d" to print Decimal integers.

Re:Problems Printing Integers

Posted: Fri Nov 29, 2002 6:55 am
by M@rtyn12345
it's a self-made printf function and I didn't write the routine for %d, but I tried to write a routine for the %i argument. I doesn't work, so I asked for help.

Re:Problems Printing Integers

Posted: Fri Nov 29, 2002 7:25 am
by Tom
I have a working printf with ints, hex...and all the other stuff.

Tell me if that works....

It is in pk0.7.1

Re:Problems Printing Integers

Posted: Fri Nov 29, 2002 7:27 am
by Pype.Clicker
This works! But now here's the problem. If I want to print the integer value zero ("0") it prints nothing (NULL?).
that doesn't astonish me as you have some "if (i==0) break;" ... probably mainly because of the recursive behaviour of the function ;-)
And integer values higher than 127 are printed in characters. For example, 128 prints "/.(" (without the quotes)
i think this is because "ch" is declared as a char rather than as an unsigned char and then casted to a unsigned ... this might give weird results from the " ch % 10" function ... (i mean negative values) that would be badly interpreted ...

btw, why do you restrict %i to chars ? why not dealing with full-sized integers ?

Re:Problems Printing Integers

Posted: Fri Nov 29, 2002 7:31 am
by Tom
Well...My old printf was not all that wonderful...it worked....but did extra things that it didn't have to ( it checked the type of \'s...but putch does that...I forgot to remove it in the release. )

I think you should use the pk0.7.1 printf.

Re:Problems Printing Integers

Posted: Fri Nov 29, 2002 7:44 am
by M@rtyn12345
OK, but where did you post it? Your page's index.html is not online.

Re:Problems Printing Integers

Posted: Fri Nov 29, 2002 7:58 am
by Tom
Having problems with SF

working link:
www.sourceforge.net/projects/fritzos