Reading unicode chars..

monarch_dodra via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 2 14:13:02 PDT 2014


On Tuesday, 2 September 2014 at 18:30:55 UTC, seany wrote:
> Your example reads the file by lines, i need to get them by 
> chars.

If you are intent on reading the stream character (or wcharacter) 
1 by 1, then you will have to decode them manually, as there is 
no "getcd".

Unfortunately, the "newer" std.stdio module does not really 
provide facilities for such unitary reads.

I'd suggest you create a range out of your std.stream.File, which 
reads it byte by byte. Then, you pass it to the "byDchar()" 
range, which will auto decode those characters. If you really 
want to do it "character by character".

What's wrong with reading line by line, but processing the 
characters in said lines 1 by 1? That works "out of the box".


More information about the Digitalmars-d-learn mailing list