digitalmars.D.bugs - [Issue 1583] New: std.cstream.CFile cannot be detached from FILE*
- d-bugmail puremagic.com (26/26) Oct 15 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1583
- d-bugmail puremagic.com (44/44) Oct 19 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1583
http://d.puremagic.com/issues/show_bug.cgi?id=1583
Summary: std.cstream.CFile cannot be detached from FILE*
Product: D
Version: unspecified
Platform: PC
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: bugzilla digitalmars.com
ReportedBy: wbaxter gmail.com
The CFile class provides a nice wrapper around a C FILE*, but it provides NO
way of disconnecting itself from the file, and ultimately will try to close
whatever file you pass to it.
In particular I think the behavior of the file(FILE*) setter and the
constructor should be considered buggy. They pretend the FILE is open even if
it is NULL.
If those methods actually checked for null, and didn't set the isopen flag in
those cases, then setting to null could be used as a way to detach the FILE.
As is, if you set the FILE* to null, there's no crash, but the CFile will
inevitably try to call fclose() on that null handle, which it should not, since
that will cause errno to get set.
Anyway, there should be a way to detach the file from the CFile. I suggest
just using "set to null" to signal that, but I'd be happy with anything.
--
Oct 15 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1583
thomas-dloop kuehne.cn changed:
What |Removed |Added
----------------------------------------------------------------------------
OS/Version|Windows |All
I use the following CFileEternal class. Compile with/without -version=kludge to
see the difference.
--
Oct 19 2007








d-bugmail puremagic.com