home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-4.ZIP / GSAMP / EXAMP39.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-09  |  868 b   |  36 lines

  1. /*
  2.  *  EXAMP39.C
  3.  *
  4.  *  The Greenleaf Comm Library
  5.  *
  6.  *  Copyright (C) 1989 Greenleaf Software Inc.  All Rights Reserved.
  7.  *
  8.  *  This example program is used to demonstrate the use of getrxcnt();
  9.  *
  10.  */
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include "asiports.h"
  14. #include "ibmkeys.h"
  15. #include "gf.h"
  16.  
  17. void main( void );
  18.  
  19. void main()
  20. {
  21.     int status;
  22.  
  23.     status = asiopen( COM1, ASINOUT | BINARY | NORMALRX, 150, 150,
  24.                       1200L, P_NONE, 1, 8, OFF, ON);
  25.     if ( status < ASSUCCESS ) {
  26.         printf( "Failed to open the port.  Status = %d\n", status );
  27.         exit( 1 );
  28.     }
  29.     asiputs( COM1, "ATS11?\r", -1 );
  30.     timer( TICKS_PER_SECOND * 2 );
  31.     printf( "There are %d characters in the receive buffer\n", getrxcnt( COM1 ) );
  32.     while ( !isrxempty( COM1 ) )
  33.         putc( asigetc( COM1 ), stdout );
  34. }
  35.  
  36.