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

FireController#1847 usfirepilot123 at gmail.com
Fri Nov 22 04:10:23 UTC 2019


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.


More information about the Digitalmars-d-learn mailing list