Title: Example of how to retrieve status of the CTS modem signal in QNX4
Keywords: CTS, QNX4, qnx_ioctl
Date: May 29, 1997
KDB: KDB-151
Revision: 0.01
Author: Support
Distribution: External
#include #include #include #include #include /* Function to look at the CTS signal */ /* Look in sys/qioctl.h for definitions */ void main( int argc, char *argv[] ){ FILE *fpSerialr; unsigned long oldbits; unsigned long maskme[2]= { 0, 0 }; if( argc < 1 ){ printf( "USE: ctsme deviceName\n" ); exit( -1 ); } fpSerialr = fopen( argv[1], "r" ); if( fpSerialr == NULL ){ printf( "Error opening device %s for input\n", argv[1] ); exit( -1 ); } setbuf( fpSerialr, NULL ); printf("\n\n"); while( 1 ) { qnx_ioctl( fileno( fpSerialr ), QCTL_DEV_CTL, maskme, 8, &oldbits, 4); if ( oldbits & 0x00100000 ) printf("CTS is high\r"); else printf("CTS is low \r"); delay (100); } }
End of KDB-151