home *** CD-ROM | disk | FTP | other *** search
- /*
- * EXAMP04.C
- *
- * The Greenleaf Comm Library
- *
- * Copyright (C) 1989 Greenleaf Software Inc. All Rights Reserved.
- *
- * This example program demonstrates the use of wide track input.
- * It prints out any character that has a parity error inside
- * brackets.
- *
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include "asiports.h"
- #include "ibmkeys.h"
- #include "gf.h"
-
- void main( void );
-
- void main()
- {
- int c;
- int status;
- char wide_status;
-
- status = asiopen( COM1, ASINOUT | BINARY | WIDETRACKRX, 100, 100,
- 1200L, P_EVEN, 1, 8, ON, ON);
- if ( status < ASSUCCESS ) {
- printf( "Failed to open the port. Status = %d\n", status );
- exit( 1 );
- }
- for ( ; ; ) {
- if ( gfkbhit() ) {
- c = getkey();
- if ( c == ESC )
- exit( 0 );
- asiputc( COM1, c );
- }
- c = asiwgetc( COM1, &wide_status );
- if ( c >= ASSUCCESS ) {
- if ( wide_status & PARITY_ERR )
- printf( "[%c]", c );
- else
- putc( c, stdout );
- }
- }
- }