I want to write a function that would tell me if stdin buffer is empty. So, here's the code:
int buff_empty()
{
char buffer[3];
fgets(buffer, 3, stdin);
if(strlen(buffer) > 1) return 0;
return 1;
}
but the problem is - I don't want fgets() to wait for my input. I'm using my own function to read, for example, an integer, and then check with this func is buffer empty (was more than one number put) or not.
Function works well, but when I read a number (read function reads just to white space, just like scanf()), it waits for one breakline(Enter?) more. Is there any way to solve it?
Thanks in advance!