From the GNU C library reference:
Function: char * fgets (char * s, int count, stream FILE *)
s, , . , s, , - 1. .
, fgets(key,1,stdin); 0 . (: )
getchar getline .
: fgets . count , , count, " " .
, :
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
int mygetch ( void )
{
int ch;
struct termios oldt, newt;
tcgetattr ( STDIN_FILENO, &oldt );
newt = oldt;
newt.c_lflag &= ~( ICANON | ECHO );
tcsetattr ( STDIN_FILENO, TCSANOW, &newt );
ch = getchar();
tcsetattr ( STDIN_FILENO, TCSANOW, &oldt );
return ch;
}
int main()
{
printf("Press any key to continue.\n");
mygetch();
printf("Bye.\n");
}