QNX6 does not support CONIO.H functions

There are a couple of functions that CONIO.H provided that QNX6 no longer supports. I need the abilities that getch() and kbhit() provided in my code, and I have tried to make the read() and tcischars() functions work with stdin, but these functions are looking for a file pointer and not a device. How should I approach this problem?

If anyone knows of function within qnx6 that respond in the same way as getch() and kbhit(), please reply.

Hello Bmclean,
Please consider the following sample code which provides the required functionality.
Thanks,
Yuriy

#include <stdio.h>
#include <termios.h>
#include <unistd.h>
#include <errno.h>
int main(int argc, char** argv)
{
int bytes_to_read;
char buf [ BUFSIZ ];
struct termios termios_p;
// Set raw mode:
if (tcgetattr( 1, &termios_p ) == -1 )
{
perror (“tcgetattr”);
return (-1);
}
if (cfmakeraw( &termios_p ) == -1 )
{
perror (“cfmakeraw”);
return (-1);
}
if (tcsetattr( 1, TCSADRAIN, &termios_p )== -1)
{
perror (“tcsetattr”);
return (-1);
}
for ( ; ; )
{
bytes_to_read = tcischars( 1); // kbhit
if (bytes_to_read == -1 )
{
perror (“tcischars”);
return (-1);

	}
	
	if (bytes_to_read  >0 )
	{
		fprintf (stderr, "kbhit %d", bytes_to_read);
	 	read( 1,  buf,	bytes_to_read ) ; // getch()
	}
}
return 0;

}

This function does emulate the getch() and kbhit() functions, and I see if you save the termios struct before making it “raw” tou can restore it latter.

Thanks.

BMcLean

[quote=“bmclean”]
This function does emulate the getch() and kbhit() functions, but it causes the “\nâ€