Unbuffered read in Solaris
Posted on 1998-07-23
I cant seem to get the code below to read the getchar statement without buffering and waiting for a CR on Solaris 2.6. This has to be a common problem, for example, how would one read a function key pressed if one had to wait for a cr. I'm sure there is a simple solution.
BTW, curses can easily perform this, but is not thread safe as the normal terminal I/O calls are.
printf("Hit any character to continue\n");
/* This next call should return without a first typing a CR */
c = getchar();
/* but it doesn't */
printf("Thank you for typing %c.\n", c);