qc.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
COM.C
                                             Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
/* COM.C illustrates serial port access using function:
 *      _bios_serialcom
 */
 
#include <bios.h>
#include <stdio.h>
 
void main()
{
    unsigned status, port;
 
    for( port = 0; port < 3; port++ )
    {
        status = _bios_serialcom( _COM_STATUS, port, 0 );
 
        /* Report status of each serial port and test whether there is a
         * responding device (such as a modem) for each. If data-set-ready
         * and clear-to-send bits are set, a device is responding.
         */
        printf( "COM%c status: %.4X\tActive: %s\n",
                (char)port + '1', status,
                (status & 0x0030) ? "YES" : "NO" );
    }
}