home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / c / other / learn / com.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-25  |  602 b   |  24 lines

  1. /* COM.C illustrates serial port access using function:
  2.  *      _bios_serialcom
  3.  */
  4.  
  5. #include <bios.h>
  6. #include <stdio.h>
  7.  
  8. main()
  9. {
  10.     unsigned status, port;
  11.  
  12.     for( port = 0; port < 3; port++ )
  13.     {
  14.         status = _bios_serialcom( _COM_STATUS, port, 0 );
  15.  
  16.         /* Report status of each serial port and test whether there is a
  17.          * modem for each. If data-set-ready and clear-to-send, modem exists.
  18.          */
  19.         printf( "COM%c status: %.4X\tModem: %s\n",
  20.                 (char)port + '1', status,
  21.                 (status & 0x0030) ? "YES" : "NO" );
  22.     }
  23. }
  24.