DOS "pause" in Linux?
Posted
by
user2930466
on Stack Overflow
See other posts from Stack Overflow
or by user2930466
Published on 2013-10-29T03:37:33Z
Indexed on
2013/10/29
3:54 UTC
Read the original article
Hit count: 95
Firstly, I'm REALLY new to programming. I've just started my first programming class two weeks ago, and I apologize if I sound newbish.
My professor wants me to implement a "press any key to continue..." thing in my program. Basically when I run a program, he wants one line to come up [like printf("jfdskaljlfja");] then what would come up is "press any key to continue," before the next line runs. he told us that the DOS equivalent is system("pause"), but he wants us to do it linux. This is what my code looks like:
#include <stdio.h>
int main()
{
printf("This is the first line of this program);
system("pause");
printf("This is the second line);
}
Except he wants us to do this in Linux, so system("pause") won't work in this case. Is there a way to have it do exactly what pause does, but in linux terms?
again, sorry if i sound newbish. thank you so much!
Also, he doesn't really care if the code is efficient or anything, as long as it runs. Again, i'm really new to programming, so the simplest answer would be much appreciated :)
© Stack Overflow or respective owner