
November 1985
National Instruments
Appendix I
Serial Port Sample Program
This appendix contains a sample program that contains code to
control the serial port of the Macintosh from a C program. It is
provided to demonstrate how to write your own serial I/O routines if
the language you are using does not already provide them..
Sample Program
send.c g-30-85 JR.
Send file out modem port, fast.
:bk=O;
Purpose:
This program is designed to send a text file
containing commands and data to the GPIB-MAC.
The program was compiled with Manx Aztec C-68K 106.F.
l
The data file is read into memory once, then sent to the
*
serial driver in a loop.
Programming languages such as
and
have too much overhead to send data faster than 19200
baud.
#include
#include
File Device managers
#include
Standard I/O
#include
#include
#include
#include
#include
File Package
l
/
#include
#define FALSE 0
main0
short
port reference numbers
l
/
char
l
pBufIn;
input buffer
int rc;
result code
int
=
input buffer size
127
APPENDIX I
PORT SAMPLE PROGRAM