Need to 'write' exactly
Nick Sabalausky
a at a.a
Sun Sep 12 13:40:18 PDT 2010
"Andrej Mitrovic" <andrej.mitrovich at gmail.com> wrote in message
news:mailman.179.1284322385.858.digitalmars-d-learn at puremagic.com...
> 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");
> }
>
Leave it to me to overlook the obvious :) This seems to work:
-------------------------------------------------
import std.stdio;
import std.string;
void main()
{
// Writes "A\rB\r\nC" on windows
//write("A\rB\nC");
// Writes "A\rB\nC"
stdout.rawWrite("A\rB\nC");
// format doesn't mess it up either, which is good
stdout.rawWrite("A\rB\nC".format());
stdout.rawWrite("%s".format("A\rB\nC"));
}
-------------------------------------------------
That wouldn't potentially interfere with any sort of buffering in write*,
would it? I assume any buffering would be at or below the "stdout" level,
rather than in the "write*" functions, but figure I should ask.
More information about the Digitalmars-d-learn
mailing list