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 / EXAMP40.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-09  |  855 b   |  39 lines

  1. /*
  2.  *  EXAMP40.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 istxfull().
  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, 1000, 1000,
  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.  
  30.     while ( !istxfull( COM1 ) )
  31.         asiputc( COM1, 'X' );
  32.     while ( !istxempty( COM1 ) ) {
  33.         printf( "%4d characters left\r", 1000 - gettxfree( COM1 ) );
  34.         timer( 2 );
  35.     }
  36.     printf("\n");
  37. }
  38.  
  39.