Printing, Is it possible to..

This is a discussion on Printing, Is it possible to.. within the C++ Programming forums, part of the General Programming Boards category; .. print via the printer device driver in Console App? And can someone demonstrate.. Thanks...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    44

    Printing, Is it possible to..

    .. print via the printer device driver in Console App?

    And can someone demonstrate..

    Thanks
    I'm using Bloodsheds Dev-C++ Compiler.

    JamMan..

    Curious if I can live forever? CLICK HERE

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    7
    IF it connected by lpt

    void main()
    {

    FILE *fp;
    fp=fopen("LPT1","w");
    fprintf(fp,"test");
    fclose(fp);
    }

  3. #3
    Unregistered
    Guest
    or you can do a search on the board for the myriad of examples on printing that look similar to this....

    Code:
    #include <iostream>
    #include <fstream>
    #include <stdlib>
    using namespace std ;
    
    int main()
    {
    
            char printer[10] = "LPT1:";
            char character;
    
            
            ofstream prnt (printer);
    
    
            if (prnt.fail()) 
            {
                    cout << "ERROR-Unable to open " << printer << '\n' ;
                    return 1 ;
            }
            system ("cls");
    
            cout << "Type the text you wish to have printed.  You must use "
                 << "\nyour own returns as there is no text wrapping other than "
                 << "\nthat which the printer will do at the end of page. Though, "
                 << "\nthis may lead to words being cut in half.  This simple "
                 << "\nprogram could be made much better utilizing iomanip for text "
                 << "\nformatting, but it shows you the basics of opening a printer "
                 << "\nport. " << endl << endl
                 << "Press a '#' and return when you are ready to print... " << endl
                 << endl << endl;
    
    
            while (character != '#')
            {
                    cin.get(character);
    
                    if(character != '#')
                       prnt.put(character);
            }
            
    
            prnt << '\r' << '\f' ; // return and eject the last page from the printer
    
    
            prnt.close();
    
    return(0);
    
    }
    not to mention... eight or so posts down is a question how to save and print. There are a lot of resources here that will help you, and most likely people before you have asked a similar question. Try the search feature on this board... there is a wealth of knowlege there.

  4. #4
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    Posts
    1,412

    logged out

    That was me...
    Blue

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, 02:13 AM
  2. generic printing preferences dialog box
    By stanlvw in forum Windows Programming
    Replies: 8
    Last Post: 06-27-2008, 03:20 AM
  3. printing data to a file
    By coralreef in forum C Programming
    Replies: 3
    Last Post: 11-02-2006, 08:10 PM
  4. need help relating printing?
    By omarlodhi in forum Linux Programming
    Replies: 0
    Last Post: 03-03-2006, 04:46 AM
  5. Printing
    By Dual-Catfish in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 05-25-2002, 09:10 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21