-1

Are there any other similar functions to pause() in Linux?

ex: to use in this code

int main(int argc, char*argv[]){  

int delay = 5;  
alarm(delay);  
pause();  
return0;  
}  
Keith Thompson
  • 254,901
  • 44
  • 429
  • 631
Jeevan
  • 1
  • 1
  • It would help if you'd describe what `pause()` does. If it's a Windows-specific function, many of the people who can tell you about Linux may not be familiar with it. You have a typo: `return0` should be `return 0`. You're also missing one or two `#include` directives. Please copy-and-paste a compilable working program. – Keith Thompson Jan 29 '14 at 23:52
  • I found sleep() also working...anyway thanks for your contribution – Jeevan Jan 30 '14 at 00:03
  • 1
    I'm glad you were able to solve your problem -- but adding the information I suggested would make this question more useful to future readers. – Keith Thompson Jan 30 '14 at 00:06
  • sure I will edit the question – Jeevan Jan 30 '14 at 00:44

1 Answers1

0

How about getchar?

puts("Press Enter to continue...");
getchar();

The user does have to press Enter (as opposed to any key), but this is platform agnostic.

Ed S.
  • 122,712
  • 22
  • 185
  • 265
  • Various tricks such as changing the terminal out of line-buffered mode can rectify that, albeit with some platform dependence - and the need to remember to set it back. – Chris Stratton Jan 29 '14 at 23:44