#include <stdio.h>
#include <stdlib.h>
#ifdef _WIN32
#include <stdlib.h>
#else
#include <termios.h>
#include <unistd.h>
#endif
int press_key();
int main()
{
press_key();
return ;
} int press_key()
{
#ifdef _WIN32
system("pause");
return ;
#else
printf("Press any key to continue...\n");
struct termios tm, tm_old;
int fd = STDIN_FILENO,c;
if (tcgetattr(fd, &tm) < )
{
return -;
} tm_old = tm;
cfmakeraw(&tm);
if (tcsetattr(fd, TCSANOW, &tm) < )
{
return -;
}
c = fgetc(stdin); if (tcsetattr(fd,TCSANOW,&tm_old) < )
{
return -;
}
return c;
#endif
}
05-26 17:42