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 / EXAMP58.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-09  |  1.3 KB  |  59 lines

  1. /*
  2.  *  EXAMP58.C
  3.  *
  4.  *  The Greenleaf Comm Library
  5.  *
  6.  *  Copyright (C) 1989 Greenleaf Software Inc.  All Rights Reserved.
  7.  *
  8.  *  This example program demonstrates the use of the HMDialInAnserMode()
  9.  *  function.  In order for this example to work, the destination phone
  10.  *  number must be a modem that will answer the call in originate mode.
  11.  *
  12.  */
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include <string.h>
  16. #include "asiports.h"
  17. #include "ibmkeys.h"
  18. #include "gf.h"
  19.  
  20. void my_putc( char c );
  21. void main( void );
  22.  
  23. void main()
  24. {
  25.     int status;
  26.     int c;
  27.  
  28.     status = asiopen( COM1, ASINOUT | BINARY | NORMALRX, 100, 100,
  29.                       1200L, P_NONE, 1, 8, ON, ON);
  30.     if ( status < ASSUCCESS ) {
  31.         printf( "Failed to open the port.  Status = %d\n", status );
  32.         exit( 1 );
  33.     }
  34.  
  35.     HMWaitForOK( TICKS_PER_SECOND, NULL );
  36.     HMSetUpEchoRoutine( my_putc );
  37.  
  38.     HMReset(COM1);
  39.     HMDialInAnswerMode( COM1, "250-3778" );
  40.     for ( ; ; ) {
  41.         if ( gfkbhit() ) {
  42.             c = getkey();
  43.             if ( c == ESC )
  44.                 exit( 0 );
  45.             else
  46.                 asiputc( COM1, c );
  47.         }
  48.         c = asigetc( COM1 );
  49.         if ( c >= ASSUCCESS )
  50.             putc( c, stdout );
  51.    }
  52. }
  53.  
  54. void my_putc( char c )
  55. {
  56.     putc( c, stdout );
  57. }
  58.  
  59.