943,549 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 2803
  • C++ RSS
Jun 25th, 2008
0

c++ print on paper

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
scream2ice is offline Offline
33 posts
since Mar 2008
Jun 25th, 2008
1

Re: c++ print on paper

Click to Expand / Collapse  Quote originally posted by scream2ice ...
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
Reputation Points: 19
Solved Threads: 20
Posting Whiz in Training
joshmo is offline Offline
280 posts
since Oct 2007
Jun 25th, 2008
2

Re: c++ print on paper

>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.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Jun 25th, 2008
0

Re: c++ print on paper

i use Microsoft Visual C++ 6.0
and my operating system is Windows XP
Reputation Points: 10
Solved Threads: 0
Light Poster
scream2ice is offline Offline
33 posts
since Mar 2008
Jun 25th, 2008
1

Re: c++ print on paper

This may be relevant.
Reputation Points: 193
Solved Threads: 25
Posting Pro
Jishnu is offline Offline
518 posts
since Oct 2006
Jun 25th, 2008
3

Re: c++ print on paper

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:
C++ Syntax (Toggle Plain Text)
  1. #include <fstream>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. ofstream printer( "prn" );
  8.  
  9. if (!printer)
  10. {
  11. cout << "fooey!\n";
  12. return 1;
  13. }
  14.  
  15. printer << "Hello world!\n";
  16.  
  17. printer.close();
  18. return 0;
  19. }
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!
Featured Poster
Reputation Points: 1140
Solved Threads: 229
Postaholic
Duoas is offline Offline
2,039 posts
since Oct 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: print as a chart
Next Thread in C++ Forum Timeline: edited. trying to get numbers from a file and calculate taxbracket.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC