Forum Navigation
ungetc?
Posted: 02/02/07 14:04:39Does Tango offer anything like Phobos's std.stream.InputStream?'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 tango.io.protocol.Reader and Writer on Cin.buffer but it didn't work the way I expected. Can it be done?












