Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact


Moderators: larsivi kris

Posted: 02/02/07 19:04:39

Does Tango offer anything like Phobos's's ungetc and ungetcw? I find them indispensable when doing character-by-character input, both with files and the console.

Or is there a smart alternative way of getting the same functionality? I took a quick browse through the Tango API and tried to think about it, but I couldn't think of an elegant way. What I could do is write my own input routines which read one dchar at a time, and if they want to push something back on the input Buffer, put it into some buffer owned by my program instead, which is always checked first before the actual Buffer.

I tried using and Writer on Cin.buffer but it didn't work the way I expected. Can it be done?

Author Message

Posted: 02/03/07 00:58:31

It probably needs a wrapper around one of the techniques noted in the other thread? Might be handy to build a utility wrapper for this kind of thing, and stuff it into tango/text/convert somewhere ...