[Prev][Next][Index][Thread]

Re: C library (printf)




 How about these.

	- Godmar

void p64(long long v)
{
    if (v < 0) v = -v, printf("-");
    if (v > 9) p64(v/10);
    printf("%d", v%10);
}

void pf(float f)
{
    printf("%d.%06d", 
        (int)f, (int)((f - (int)f) * (f < 0 ? -1000000 : 1000000)));
}

> 
> Hi all,
> I need to print the value of a 64 bit integer (type long long) and a
> floating point number in a kernel built using oskit. The printf provided
> in the oskit C library does not seem to support either of the 2 formats.
> Is there a way of incorporating these features in the printf.
> If not, is there any other function i could use to do the same.
> Thanks in advance, 
> 
> -- 
> Puneet Zaroo
> email:puneet@cse.iitd.ernet.in
>       puneetzaroo@rediffmail.com
> 
> url : people.cse.iitd.ernet.in/puneet
> 
> Recursion n.:
>         See Recursion.
>                 -- Random Shack Data Processing Dictionary
> 
> --------------------------------------------------------------------------

Follow-Ups: References: