LockingTextWriter/Reader

Adam D. Ruppe destructionator at gmail.com
Fri Oct 12 10:06:16 PDT 2012


std.stdio has a nice struct called LockingTextReader in the 
source. The thing is it isn't documented at all, and I don't 
think it even does its own interface.

It claims to return dchars, but apparently reads bytes.

Its counterpart, LockingTextWriter, seems to do a little more 
dchar related stuff but again, I'm not sure what exactly it is 
supposed to do.



What are these supposed to actually do? I tried doing a simple 
unix cat like program:

stdout.write(LockingTextReader(File("in"));

and while it worked correctly on an ascii text file, it corrupted 
a binary file. The name "Text" makes me think it isn't meant to 
work on a binary file, but it'd be so useful if it did...

and besides, if it assumes utf8, why didn't it throw an invalid 
text exception when fed the binary data?


So, my question is: what are these supposed to do? I'd really 
like to have byChar and byByte equivalents and this comes close 
but not quite. Bug?


More information about the Digitalmars-d-learn mailing list