Thread: How do I print to COM1 via DOS?

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    3

    Question How do I print to COM1 via DOS?

    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

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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?

  3. #3
    Registered User
    Join Date
    Jul 2002
    Posts
    3
    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

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    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

  5. #5
    Registered User
    Join Date
    Jul 2002
    Posts
    3
    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

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File systems?? (Winxp -> DOS)
    By Shadow in forum Tech Board
    Replies: 4
    Last Post: 01-06-2003, 09:08 PM
  2. print output problem
    By chor in forum C Programming
    Replies: 1
    Last Post: 12-29-2002, 09:45 AM
  3. Replies: 1
    Last Post: 07-31-2002, 11:35 AM
  4. send data to printer and print on paper
    By ooosawaddee3 in forum C Programming
    Replies: 1
    Last Post: 07-22-2002, 05:19 AM
  5. How Can I print
    By kas2002 in forum C++ Programming
    Replies: 2
    Last Post: 06-22-2002, 10:07 AM