kbhit() for enter key? not working
I'm trying to make a loop to build a string while the program is running. When the enter key is hit I want to process the string. Basically I want gets() without blocking. So I'm trying to use kbhit() to do this.
PHP Code:
if (kbhit())
{
str[stri] = getch();
cout << str[stri];
if (str[stri] == '\n')
{
//rakClientInterface->RPC("PrintMessage", str, (strlen(str)+1)*8, HIGH_PRIORITY, RELIABLE, 0, false);
system("PAUSE");
stri = 0;
str[0] = '\0';
}
else
{
stri++;
}
}