Need to 'write' exactly

Andrej Mitrovic andrej.mitrovich at gmail.com
Sun Sep 12 13:12:56 PDT 2010


Have you tried using rawWrite ? There's a unittest in the definition
which looks like something you need:

    unittest
    {
        auto f = File("deleteme", "w");
        scope(exit) std.file.remove("deleteme");
        f.rawWrite("\r\n\n\r\n");
        f.close();
        assert(std.file.read("deleteme") == "\r\n\n\r\n");
    }

On Sun, Sep 12, 2010 at 10:07 PM, Nick Sabalausky <a at a.a> wrote:
> I'm outputting some stuff to stdout with the write* functions, but with what
> I'm doing at the moment I need complete control over each byte that gets
> output. On windows, write auto-converts \n to \r\n, which is normally good,
> but this time I need to get around that and output it just as-is. How can I
> do that? Is there a lower level function that's guaranteed not to interact
> poorly with write (ie, no potential for any weird buffering-race issues)?
>
> Also, are there any other situations where any of the write functions might
> alter the specific bytes passed in?
>
>
>


More information about the Digitalmars-d-learn mailing list