home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.msdos.programmer
- Path: sparky!uunet!caen!destroyer!ubc-cs!davidson
- From: davidson@cs.ubc.ca (Mark Davidson)
- Subject: Serial Port Setup
- Message-ID: <1992Aug26.202240.1342@cs.ubc.ca>
- Summary: Need help with system specifics or C code
- Keywords: serial input output setup
- Sender: usenet@cs.ubc.ca (Usenet News)
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Date: Wed, 26 Aug 92 20:22:40 GMT
- Lines: 46
-
-
- I'm writing an software interface for a PS/2 model 90 to communicate
- with a Sony videodisc recorder (LVR-5000) and I'm having problems
- setting up the serial port. I looked at the FAQ BTW, I'm using Borland
- C++ 3.0 and running it in a DOS window in OS/2 (comp.msdos.programmer)
- which refered to two books, neither of which the library or the campus
- bookstore has.
-
- I've defined the name and the settings of the port in the following
- macro
-
- #define DEFAULT_PORT "COM1: 9600, N, 8, 1"
-
- I've tried "COM1:9600N81" with COM2 as well. I use the DEFAULT_PORT
- macro as an argument to the following function:
-
- setup_tty(char *dev_name)
- {
- int ofile_d;
- if (!( ofile = fopen(dev_name, "w"))) {
- fprintf(stderr,"Could not open %s for write\n", dev_name);
- exit(1);
- }
-
- if (!( ifile = fopen( dev_name, "r"))) {
- fprintf(stderr,"Could not open %s for read\n", dev_name);
- exit(1);
- }
- etc...
-
- And I get the first stderr message all the time.
-
- Could someone recommend how to properly set up a serial port for input
- and output.
-
- The machine is a PS/2 model 90 running OS/2 2.0 and I'm writing the
- program in a DOS window using Borland C++ 3.0.
-
- Thanks,
-
-
- --
- ******************************************************
- * Mark Davidson davidson@cs.ubc.ca *
- * University of British Columbia _ ^ *
- * Mountain Bike Heaven ^ @_(*)/ \ ^ *
-