I was looking over some code put together by Harpreet Singh Juneja and tried to compile it to see what happens. I get these two errors:
90 d:\portsp~1\hsport.cpp
implicit declaration of function `int _kbhit(...)'
102 d:\portsp~1\hsport.cpp
implicit declaration of function `int _getch(...)'
I am thinking that the problem is this was done in VC++ and I am using Dev-C++.
here is the part with the problem:
Code:
if (strlen(buffer) > 2) /* we have a wait specification */
{
hsport.token(&buffer[1],&token_ptr);
if (token_ptr != NULL) /* if pattern specified */
{
sscanf(token_ptr,"%x",&match_byte);
printf("Waiting for byte %4.4x. Hit any key to terminate\n",match_byte);
hsport.rdport();
while (!_kbhit())
{
save_byte = hsport.getbyte();
hsport.rdport();
if (hsport.getbyte() == match_byte)
{
printf("Pattern %4.4x found, hit any key.\n",hsport.getbyte());
hsport.setbyte(save_byte);
break;
}
hsport.setbyte(save_byte);
}
_getch(); /* clears the port */
}
}
so how should it be fixed?