On 11/21/19 9:10 PM, Mike Parker wrote:> On Friday, 22 November 2019 at 04:45:21 UTC, Mike Parker wrote:

> You need to call readf with a character
> format string (%c):
>
> import std.stdio;
> void main()
> {
>      writeln("Press any key to continue...");
>
>      char c;
>      readf("%c", &c);
>      writeln("Thanks!");
> }

Unfortunately, that won't work either as it requires stdin to be unbuffered, which is not the case in most terminals.

The main issue here is that a D program cannot know that stdin is bound to a keyword. One needs to use a terminal module like the suggested curses or Adam's terminal.d:

  https://github.com/adamdruppe/arsd/blob/master/terminal.d

If it's too much unnecessary complication, then "Press Enter to continue..." is perfectly fine to me. ;) (But of course you can't move the cursor with that. :/)

Ali

Reply via email to