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

2019-11-22 Thread Jesse Phillips via Digitalmars-d-learn
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;

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

2019-11-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 22 November 2019 at 09:25:37 UTC, Ali Çehreli wrote: https://github.com/adamdruppe/arsd/blob/master/terminal.d I have this exact thing as a sample in my docs: http://dpldocs.info/experimental-docs/arsd.terminal.html#single-key You could wrap that up in a function if you don't

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

2019-11-22 Thread IGotD- via Digitalmars-d-learn
On Friday, 22 November 2019 at 04:45:21 UTC, Mike Parker wrote: On Friday, 22 November 2019 at 04:22:07 UTC, FireController#1847 wrote: Right, but readln will only wait until the user presses the delimiter (by default Enter/Return). I want it to wait until ANY key is pressed, not a specific

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

2019-11-22 Thread Ali Çehreli via Digitalmars-d-learn
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", );

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

2019-11-21 Thread Mike Parker via Digitalmars-d-learn
On Friday, 22 November 2019 at 04:45:21 UTC, Mike Parker wrote: On Friday, 22 November 2019 at 04:22:07 UTC, FireController#1847 wrote: Right, but readln will only wait until the user presses the delimiter (by default Enter/Return). I want it to wait until ANY key is pressed, not a specific

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

2019-11-21 Thread Mike Parker via Digitalmars-d-learn
On Friday, 22 November 2019 at 04:22:07 UTC, FireController#1847 wrote: Right, but readln will only wait until the user presses the delimiter (by default Enter/Return). I want it to wait until ANY key is pressed, not a specific key The documentation for std.stdio.File shows two functions

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

2019-11-21 Thread mipri via Digitalmars-d-learn
On Friday, 22 November 2019 at 04:41:30 UTC, mipri wrote: ~this() { reset(); } Oh, if you don't ever call raw() this will break your terminal. I just copied some code from a toy program and adapted it, and didn't notice that until I posted.

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

2019-11-21 Thread mipri via Digitalmars-d-learn
On Friday, 22 November 2019 at 04:22:07 UTC, FireController#1847 wrote: Right, but readln will only wait until the user presses the delimiter (by default Enter/Return). I want it to wait until ANY key is pressed, not a specific key If curses is available you can use it, at the cost of

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

2019-11-21 Thread FireController#1847 via Digitalmars-d-learn
On Friday, 22 November 2019 at 04:19:40 UTC, mipri wrote: 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

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

2019-11-21 Thread mipri via Digitalmars-d-learn
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;

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

2019-11-21 Thread FireController#1847 via Digitalmars-d-learn
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();