Thread: printing in C/C++

  1. #1
    Unregistered
    Guest

    Unhappy printing in C/C++

    I'm trying to print files to an epson printer but I just cant find any help files anywhere could anyone point me in the right direction?

  2. #2
    Evil Member
    Join Date
    Jan 2002
    Posts
    638
    The make of the printer ought not to matter for text printing under DOS. Assuming the printer is on LPT1, try:

    Code:
       ofstream prnt ("LPT1");  //An output stream
       if (prnt.fail()) {
          cout << "Cannot open printer port.\n" ;
          return 1 ;
       }
       prnt << "Whatever"; 
          //just like you would use cout
       prnt.close();

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    27
    Hi,
    Nowadays many printers will not print in DOS. Before going any further look up your printer on the net to find out if it will print in DOS.
    If not, easiest work around is to print to a file.
    Then open and print the file from notepad.

    Hope this helps.
    Pappy
    You learn something new everyday.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C# Printing Problem
    By silverlight001 in forum C# Programming
    Replies: 0
    Last Post: 03-23-2009, 01:13 AM
  2. Printing Lines to .txt File
    By Programmer3922 in forum C Programming
    Replies: 2
    Last Post: 08-02-2008, 12:45 PM
  3. generic printing preferences dialog box
    By stanlvw in forum Windows Programming
    Replies: 8
    Last Post: 06-27-2008, 02:20 AM
  4. printing data to a file
    By coralreef in forum C Programming
    Replies: 3
    Last Post: 11-02-2006, 08:10 PM
  5. need help relating printing?
    By omarlodhi in forum Linux Programming
    Replies: 0
    Last Post: 03-03-2006, 04:46 AM