Read a unicode character from the terminal

Jacob Carlborg doob at me.com
Sun Apr 1 12:16:11 PDT 2012


On 2012-04-01 16:02, Ali Çehreli wrote:

> No difference in that example because it consumes the entire input as
> dchars.
>
> But in general, with that inefficient range, it is possible to pull just
> one dchar from the input and leave the rest of the stream untouched. For
> example, it would be possible to readf() an int right after that:
>
> auto u = byUnicode();
>
> dchar d = u.front; // <-- reads just one dchar from the range
>
> int i;
> readf("%s", &i); // <-- continues with std.stdio functions
> writeln(i);
>
> With the getline() method, the int must be looked up in the line first,
> then from the input.
>
> Ali

Ok, I see, thanks.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list