Can i send data to my printer through ms-dos based c++ program?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • profall
    New Member
    • Aug 2010
    • 7

    Can i send data to my printer through ms-dos based c++ program?

    for example to print through LPT1, i can use
    <code>FILE*prin ter;
    printer=fopen(" LPT1","wb+");
    fprintf(printer ,"This is message");
    </code>
    but i want to send it to:USB001
    is there a way without going to windows or MFC?
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    What are you asking? The code above does not require Windows or MFC.

    Comment

    • newb16
      Contributor
      • Jul 2008
      • 687

      #3
      I'm not sure that modern printers have teletype mode at all. Taking into account that 'Quite a few parallel port printers don't work in straight ASCII DOS mode either'...

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        The C languaage requires printers to conform to stdout which is a serial teletype. Your printer driver handles this for you. That's why you can print on a 2010 laser printer using a C program written in 1975.

        All you have to to is use stdout.

        Comment

        Working...