hi,
does anyone know if there is a code in c++ that allows print on paper instead of monitor?

i mean instread of using 'cout<<' to see what you want on monitor, use a code to print your info on paper.......cheers

hi,
does anyone know if there is a code in c++ that allows print on paper instead of monitor?

i mean instread of using 'cout<<' to see what you want on monitor, use a code to print your info on paper.......cheers

Perhaps output to a file then printing the file :)

Comments
thnx

>does anyone know if there is a code in c++ that allows print on paper instead of monitor?
Communicating with specific hardware is outside the bounds of standard C++. If you want a good answer, you need to tell us what compiler you're using and your operating system.

Comments
thnx

If all you want is teletype output (like you get on the console, without any fancy graphics or fonts or etc) you can open the PRN or LPT1 device:

#include <fstream>
#include <iostream>
using namespace std;

int main()
  {
  ofstream printer( "prn" );

  if (!printer) 
    {
    cout << "fooey!\n";
    return 1;
    }

  printer << "Hello world!\n";

  printer.close();
  return 0;
  }

Most PC printers that I know of can handle simple TTY output of this kind. If you open in binary mode you can also send printer control codes (specific to your printer) to program it.

Have fun!

Comments
thnx
Great post, and sorry for giving you crap when I first joined.
This article has been dead for over six months. Start a new discussion instead.