Thread: make the printer function on my program!!!!

  1. #1
    Registered User
    Join Date
    Sep 2005

    make the printer function on my program!!!!

    hello all~~~
    i have question that can i print out my console window by using printer directly by enter some character in my program ???

    do you wan to print this console window? p

    after user enter p, the printer start printing the particular console window.

    i am using

    the program should run under console window app mode....


  2. #2
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Out of scope
    I'm really not understanding what you're asking...

    ...if you're talking about an actual print (that prints ink on a sheet of paper), then the simplest way would be to just open the printer port as a file and output to it like you would a text file.

    #include <fstream>
    int main() {
      std::ofstream Printer;"LPT1");   // This may not nessasarily be your printer port.
      Printer << "PRINTED TEXT. \f";  // The \f is formfeed.
      return 0;
    Also, you should understand that this has a ton of flaws. It only works assuming your printer can recieve plain text. For example, a PostScript printer won't print unless the output is coming through a PostScript printer driver. If you want to do it correctly, then look into some documentation on Windows XP and find out how to send the output to the OS's printer manager.
    Last edited by SlyMaelstrom; 03-17-2006 at 04:18 AM.
    Sent from my iPadŽ

  3. #3
    Registered User
    Join Date
    Sep 2005
    ya......wat i mean is print it on a paper....
    means when the user keep in some command the printer will start to print out the console window excute by the user on that time...

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Some enviroments have a C file stream called stdprn.

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell

    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ:

    My website:
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 06:54 PM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  3. Bisection Method function value at root incorrect
    By mr_glass in forum C Programming
    Replies: 3
    Last Post: 11-10-2005, 09:10 AM
  4. Change this program so it uses function??
    By stormfront in forum C Programming
    Replies: 8
    Last Post: 11-01-2005, 08:55 AM
  5. Replies: 3
    Last Post: 03-04-2005, 02:46 PM