home *** CD-ROM | disk | FTP | other *** search
- /*
- * EXAMP06.C
- *
- * The Greenleaf Comm Library
- *
- * Copyright (C) 1989 Greenleaf Software Inc. All Rights Reserved.
- *
- * This example program demonstrates the use of asiputb() and asigets_timed().
- * We send an "AT" string to the modem, and wait to get characters back.
- * The asigetb_timed will get as many characters as possible until the
- * timeout time is used up.
- *
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include "asiports.h"
- #include "ibmkeys.h"
- #include "gf.h"
-
- void main( void );
-
- void main()
- {
- int count;
- int status;
- char buffer[81];
-
- status = asiopen( COM1, ASINOUT | BINARY | NORMALRX, 100, 100,
- 1200L, P_NONE, 1, 8, ON, ON);
- if ( status < ASSUCCESS ) {
- printf( "Failed to open the port. Status = %d\n", status );
- exit( 1 );
- }
- asiputb( COM1, "AT\r", 3 );
- count = asigets_timed( COM1, buffer, 81, '\r', TICKS_PER_SECOND*2 );
- printf( "Read in %d characters, string=%s\n", count, buffer );
- }
-