[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
has the same bug although the printf code is somewhat rewritten.
Havn't tested it though, just looked at the code.
----- Original Message -----
From: Prabhat Avasare <firstname.lastname@example.org>
Sent: Saturday, May 05, 2001 6:24 PM
Subject: problem with fprintf()
> 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: email@example.com
> Kapeldreef 75 Tel: +32-16-288123
> B3001 Leuven Fax: +32-16-281515