is there a way to pause a program and resume with just a key press (or enter key)

rumbu via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 15 03:22:51 PDT 2014


On Tuesday, 15 July 2014 at 02:49:56 UTC, WhatMeWorry wrote:
> Sorry if this is an incredibly naive question.
>
> I prefer to pragmatically pause my programs periodically so 
> that I can peruse output statements. Ideally, I'd like to 
> continue by just hitting any old key. My feeble attempt below 
> requires I enter at least one character and then the enter key.
>
> char ignore;
> writeln("Enter to continue");
> readf(" %s", &ignore);
>
> Is there a way to continue with any old key press? or just the 
> enter key?
>
> Thanks in advance.


getch() reads any key and continues;

On Windows you can pipe you executable with the "more" command to 
pause after each page: your.exe | more


More information about the Digitalmars-d-learn mailing list