[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: file:write() fails silently for read-only files
- From: Tony Finch <dot@...>
- Date: Thu, 8 Sep 2011 13:05:09 +0100
On Thu 8 Sep 2011, at 12:24, Reuben Thomas wrote:
> I got a contradictory result:
>
> $ cat foo.c
> #include <stdio.h>
>
> int main (void)
> {
> FILE *f = fopen("foo", "r");
> int ret = fprintf(f, "dfoo");
> printf ("%d %d\n", ret, ferror(f));
> }
> $ gcc -o foo foo.c
> $ ./foo
> -1 1
Weird. It prints 4 1 for me.
Darwin bips2002.fibl.ch 11.1.0 Darwin Kernel Version 11.1.0: Tue Jul 26 16:07:11 PDT 2011; root:xnu-1699.22.81~1/RELEASE_X86_64 x86_64
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
Copyright (C) 2007 Free Software Foundation, Inc.
Tony.
--
f.anthony.n.finch <dot@dotat.at> http://dotat.at/
- References:
- file:write() fails silently for read-only files, HyperHacker
- Re: file:write() fails silently for read-only files, startx
- Re: file:write() fails silently for read-only files, HyperHacker
- Re: file:write() fails silently for read-only files, startx
- Re: file:write() fails silently for read-only files, steve donovan
- Re: file:write() fails silently for read-only files, Enrico Colombini
- Re: file:write() fails silently for read-only files, Josh Simmons
- Re: file:write() fails silently for read-only files, Josh Simmons
- Re: file:write() fails silently for read-only files, steve donovan
- Re: file:write() fails silently for read-only files, liam mail
- Re: file:write() fails silently for read-only files, steve donovan
- Re: file:write() fails silently for read-only files, Tony Finch
- Re: file:write() fails silently for read-only files, Reuben Thomas