This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/2170] New: The ,ccs argument to fopen() produces stream broken for writing
- From: "hniksic at xemacs dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 18 Jan 2006 10:35:42 -0000
- Subject: [Bug libc/2170] New: The ,ccs argument to fopen() produces stream broken for writing
- Reply-to: sourceware-bugzilla at sourceware dot org
fopen(filename, "w,ccs=UTF-8") succeeds, but produces a stream that does not
appear to generate any output. iconv -l does list UTF-8 as a legal coding.
How to repeat:
This simple program, expected to write UTF-8 output, fails to produce any
content in the output file:
#include <stdio.h>
int main(int argc, char **argv)
{
FILE *fp = fopen("fl", "w,ccs=UTF-8");
fputs("ab", fp);
if (ferror(fp)) perror("fputs");
fclose(fp);
return 0;
}
Expected result:
After running the program, a file "fl" should be created. It should be two
bytes long, those bytes being the ASCII characters 'a' and 'b'.
Actual result:
fl is created, but it is empty.
Adding an fflush before fclose and/or replacing fputs with fwrite or fprintf
makes no difference. The problem appears with codings other than UTF-8 as well.
If ",ccs=UTF-8" is removed, the expected result occurs. If
",ccs=no-such-coding" is used, fopen() fails (as expected).
--
Summary: The ,ccs argument to fopen() produces stream broken for
writing
Product: glibc
Version: 2.3.5
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: hniksic at xemacs dot org
CC: glibc-bugs at sources dot redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=2170
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.