www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 590] New: std.stream has no way to create a text-mode file

http://d.puremagic.com/issues/show_bug.cgi?id=590

           Summary: std.stream has no way to create a text-mode file
           Product: D
           Version: 0.174
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: wbaxter gmail.com


Or perhaps this bug should be there's no binary mode 'din' and 'dout' because
the inconsistency is really the problem.

The std.stream and std.cstream modules try to present a uniform interface to
stream io.  The problem is that C's FILE handles have a concept of text mode vs
binary mode, and stdin and stdout C FILE streams are always text mode.  However
it is not possible to create a std.stream.File or BufferedFile in text mode.  

Therefore if I want to write a stream function that consistently handles both
stdio and file streams like:

  write_some_text(OutputStream stream) {
      stream.writef("\n");
  }

this will give different output (on Windows) depending on whether stream is
std.cstream.dout or a std.stream.BufferedFile.


-- 
Nov 23 2006