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

Re: problem with fprintf()



Look like you found a bug in uC-libc.
It uses strlen() (or checking for '\0') after writing data to the 
string even if it's %c that wrote to the string and writing a
'\0' should be possible.
It looks like the latest version of uC-libc from 
http://cvs.uclinux.org/uClibc.html and
http://opensource.lineo.com/cgi-bin/cvsweb/uClibc/stdio/
has the same bug although the printf code is somewhat rewritten.
Havn't tested it though, just looked at the code.

/Johan



----- Original Message ----- 
From: Prabhat Avasare <avasare@xxxxxxx.be>
To: <dev-etrax@xxxxxxx.com>
Sent: Saturday, May 05, 2001 6:24 PM
Subject: problem with fprintf()


> Hi.
> 
> When I compile a simple program like below -
> 
> #include <stdio.h>
> 
> int main()
> {
>   FILE *f = fopen("test","w");
> fputc(0, f);
> fprintf(f,"%c", 0);
> return 0;
> }
> 
> fputc() writes the character 0 correctly, but not fprintf().
> In fact, fprintf() doesnt write anything! This happens only
> with character 0 - I checked few others and they were ok.
> What could be the reason?
> 
> Such a problem usually takes a long time to debug, better to
> mention it somewhere :-)
> 
> I am using ETRAX 100 board with devboard-R1_0_2 software release.
> 
> Best wishes,
> -- prabhat
> 
> --
> Prabhat Avasare    IMEC (DESICS)          email: avasare@xxxxxxx.be
>                    Kapeldreef 75            Tel: +32-16-288123
>                    B3001 Leuven             Fax: +32-16-281515
>                    Belgium.
>