On Wed, 26 Sep 2012 13:06:03 -0500, Adam D. Ruppe
wrote:
On Wednesday, 26 September 2012 at 17:51:03 UTC, Thomas Koch wrote:
How can I read single characters?
The way I'd do it is with the C call fgetc(stdin). You can do it in D
the same way if you import core.stdc.stdio;
But, if you a
On 2012-09-26 19:51, Thomas Koch wrote:
Hi,
to learn D, I'd like to write a simple type trainer. It should write a line
to stdout and then read single characters from stdin and only accept the
correct characters
How can I read single characters?
A similar question has been asked before without
On Friday, 28 September 2012 at 09:45:30 UTC, Thomas Koch wrote:
nazriel wrote:
http://dpaste.dzfl.pl/eb1387cc
Thank you. Your solution does not seem to work with multibyte
characters, so
I extended it:
Nice, I didn't need multibyte support as I was using it mainly
for getting keycode
nazriel wrote:
> http://dpaste.dzfl.pl/eb1387cc
Thank you. Your solution does not seem to work with multibyte characters, so
I extended it:
import core.sys.posix.termios;
import core.stdc.stdio;
char getch()
{
int ch;
termios oldt;
termios newt;
tcgetattr(0, &o
Ali Çehreli wrote:
> Considering that stdin is a char stream and that there is no concept of
> a keyboard or a monitor in D (nor in C and nor in C++), I stand by my
> solution from that thread: :)
Thank you, especially for the link, but your proposal still requires to
press enter.
Regards, Thomas
On Wednesday, 26 September 2012 at 17:51:03 UTC, Thomas Koch
wrote:
Hi,
to learn D, I'd like to write a simple type trainer. It should
write a line
to stdout and then read single characters from stdin and only
accept the
correct characters
How can I read single characters?
A similar questio
On Wednesday, 26 September 2012 at 17:51:03 UTC, Thomas Koch
wrote:
How can I read single characters?
The way I'd do it is with the C call fgetc(stdin). You can do it
in D the same way if you import core.stdc.stdio;
But, if you are on Linux, it isn't going to be that simple. The
Linux termi