PDA

View Full Version : How do I print to COM1 via DOS?



JWHolland
07-30-2002, 07:52 PM
I need to print to COM1 from my C program running under DOS and it "appears" that I might be able to use the bios function bioscom(cmd,byte,port) to accomplish this. (This function is in bios.h)

If this is the case, does anyone know how to address the handshaking requirements? Does the XON/XOFF signal from the printer appear by magic in the MSR (modem status register) or what?

I am unable to even find the term XON or XOFF in any of my hardware or programming books. Also, I am using Borland's C++ version 5.02 compiler.

Any help is greatly appreciated.

Thanks,

John

Salem
07-30-2002, 10:49 PM
Mmm, you talk about DOS, yet you seem to be using a win32 console compiler.

It might look like DOS, but a win32 console with it's c:> prompt is not DOS.

So what environment do you actually have?

JWHolland
07-31-2002, 04:31 AM
I don't understand your reply unless you are referring to the fact that Borland's v5.02 C/C++ compiler does run on a windows platform (98 in my case).

However, the problem I need help with is for a program compiled to produce a (large model) DOS ".exe" file.

Also, even though I do some program testing in a DOS window (on this computer), final testing and operation is on a straight DOS computer.

John

Fordy
07-31-2002, 05:36 AM
Originally posted by JWHolland
I don't understand your reply unless you are referring to the fact that Borland's v5.02 C/C++ compiler does run on a windows platform (98 in my case).

However, the problem I need help with is for a program compiled to produce a (large model) DOS ".exe" file.

Also, even though I do some program testing in a DOS window (on this computer), final testing and operation is on a straight DOS computer.

John

I think Salem was saying that Borland's v5.02 C/C++ compiler is a windows compiler that creates a standard Windows PE format exe file........not the DOS style exe that you are trying to produce

JWHolland
07-31-2002, 06:14 AM
I think we are getting lost on a bunny trail. Please refer to the original question. As I implied there, I'm not sure that I am even headed in the right direction using the bios function mentioned.

However, the compiler in question does in fact allow creation of DOS ".exe" files (both standard and overlay) via project/target/platform. I only mentioned the compiler in the first place to indicate a "preference" to C code and that I have access to more commands/functions than those defined by ANSI.

John

Salem
07-31-2002, 02:17 PM
Well the flow control bits can be explained by
http://wombat.doc.ic.ac.uk/foldoc/foldoc.cgi?XON%2FXOFF
http://users.evtek.fi/~tk/rt_html/rtgif048.htm

As for the bioscom functions, you can but try it. The flow control characters XON/XOFF may appear as characters in the data stream assuming the serial line driver handles them for you.

If it doesn't, then you will have to do this yourself.