How to simulate Window's "Press any key to continue..."

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Fri Nov 22 15:38:41 UTC 2019


On Friday, 22 November 2019 at 04:10:23 UTC, FireController#1847 
wrote:
> I'm an extreme beginner to DLang (just started using it.. oh, 
> an hour ago?), and I already can't figure out a, what I'd 
> consider, fairly simplistic thing.
>
> This is my current code:
>
> module DTestApp1;
>
> import std.stdio;
>
> int main() {
>     write("Press any key to continue...");
>     stdin.read();
>     return 0;
> }
>
> I am using Visual Studio to write it, and no matter what I do I 
> cannot get it to work. I attempted to import std.stream;, but 
> it said that while it could find the file, it cannot be read. 
> Am I using the wrong function?
>
> For those who don't know, what I'm trying to do is pause the 
> program until literally any key is pressed while in the console.

execute(["pause"]);


More information about the Digitalmars-d-learn mailing list