[Issue 14505] File doesn't rewind read pointer for a+ mode on Windows DMC

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Apr 27 06:21:05 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14505

Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com

--- Comment #5 from Steven Schveighoffer <schveiguy at yahoo.com> ---
I don't think there's any requirement in C for this to be the case.

What your test case has exposed is implementation differences for different C
libraries.

Note that I can write a C program that compiles with both MSVCRT and DMC
library, and have the same issue. D does not do anything to the file pointer in
the "a+" case. We only do it in the "a" case, since that case will not cause
issues for any other usage (you can only write to an "a" file, and it should
always write to the end of the file), but fixes an issue with std.process.

I'm tempted to close as INVALID.

(In reply to Vladimir Panteleev from comment #4)
> Is ftell supposed to return specifically the read pointer's position (and
> not the write pointer's)?

It tells the current position of the file descriptor. There is no different
"read" or "write" pointer. When writing, the C library (or the OS in the case
of Unixen) seeks the stream to the end.

--


More information about the Digitalmars-d-bugs mailing list