Should File.rawWrite() write data to file in binary mode?  Or should it
just transparently call fwrite() as documented?

I saw a D user who had trouble writing binary data to stdout on Windows.
Every occurrence of 0x0A was translated to 0x0D 0x0A even he used
stdout.rawWrite() -- because stdout was opened in text mode.

Try this:
--------------------
import std.stdio;
void main()
{
    ubyte[] data = [ 0x9, 0xA, 0xB ];
    stdout.rawWrite(data);
}
--------------------
On Windows, this program writes [ 0x9, 0xD, 0xA, 0xB ].

I think File.rawWrite() should always write data in binary mode
regardless of which mode is set.

What do you think?


Shin
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to