[comp.sys.ibm.pc.misc] Writing data to com3:

foote@miro.Berkeley.EDU (Bill Foote) (11/28/90)

    (The following is posted for a friend who doesn't have net access. 
     Please reply via e-mail so I can forward the responses.  Thanks.)

Help!

Could some one tell me how I can go about writing data out to a COM3 or COM4
port in DOS using C?

Or can someone tell me if there are any DOS tricks or utilities out there that 
will let me do something like "mode com3:1200,8,1" and then "mode lpt1:=com3:"?

I would like to do something like:

	fp = fopen ("COM3","w") ;
	fprintf (fp,"TEST\n") ;

This works fine for COM1 and COM2 but it doesn't work for COM >= 3.

I've got an AT compatible with 6 COM ports and COM1 and 2 are already in use.
So therefore I'm stuck with this task of trying to write to COM 3 or higher.
I'm running Microsoft C version 5.1.

Thanks for all of your help.  

    -- Charles Lei

achilles@unixland.uucp (David Holland) (12/03/90)

Writing data to ANY serial port from just about anything other than Basic 
(which has its own library for the purpose) is not a trivial undertaking. 
Even for COM1: and COM2:, the DOS drivers are completely inadequate. The 
BIOS is worse than useless, so you're basically left writing your own 
low-level interrupt handler. I have such a thing; if you want a copy of it 
send me mail. 
-------
 David A. Holland
 
internet  <pro-angmar!achilles@alphalpha.com>
UUCP      <[host]!alphalpha!pro-angmar!achilles>