home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / msdos / programm / 8826 < prev    next >
Encoding:
Text File  |  1992-08-26  |  1.7 KB  |  56 lines

  1. Newsgroups: comp.os.msdos.programmer
  2. Path: sparky!uunet!caen!destroyer!ubc-cs!davidson
  3. From: davidson@cs.ubc.ca (Mark Davidson)
  4. Subject: Serial Port Setup
  5. Message-ID: <1992Aug26.203429.1674@cs.ubc.ca>
  6. Summary: Need help with system specifics or C code
  7. Keywords: serial input output setup
  8. Sender: usenet@cs.ubc.ca (Usenet News)
  9. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  10. Date: Wed, 26 Aug 92 20:34:29 GMT
  11. Lines: 43
  12.  
  13.  
  14. I'm writing an software interface for a PS/2 model 90 to communicate
  15. with a Sony videodisc recorder (LVR-5000) and I'm having problems
  16. setting up the serial port. I looked at the FAQ BTW, I'm using Borland
  17. C++ 3.0 and running it in a DOS window in OS/2 (comp.msdos.programmer)
  18. which refered to two books, neither of which the library or the campus
  19. bookstore has.
  20.  
  21. I've defined the name and the settings of the port in the following
  22. macro
  23.  
  24. #define DEFAULT_PORT "COM1: 9600, N, 8, 1"
  25.  
  26. I've tried "COM1:9600N81" with COM2 as well. I use the DEFAULT_PORT
  27. macro as an argument to the following function:
  28.  
  29. setup_tty(char *dev_name)
  30. {
  31.    int ofile_d;
  32.    if (!( ofile = fopen(dev_name, "w"))) { 
  33.     fprintf(stderr,"Could not open %s for write\n", dev_name); 
  34.     exit(1);
  35.     }
  36.  
  37.    if (!( ifile = fopen( dev_name, "r"))) { 
  38.     fprintf(stderr,"Could not open %s for read\n", dev_name);
  39.     exit(1); 
  40.     }
  41. etc...
  42.  
  43. And I get the first stderr message all the time.
  44.  
  45. Could someone recommend how to properly set up a serial port for input
  46. and output.
  47.  
  48. The machine is a PS/2 model 90 running OS/2 2.0 and I'm writing the 
  49. program in a DOS window using Borland C++ 3.0.
  50.  
  51. Thanks,
  52.  
  53. -- 
  54. * Mark Davidson       University of British Columbia  *
  55. * davidson@cs.ubc.ca                                  *
  56.