is there any c++ code that allows me to print the screen?
is there any c++ code that allows me to print the screen?
if you mean print in text mode try this
#include <iostream.h>
void main()
{
cout << "I am printing to the screen";
}
the #include directive with <iostream.h> is necessary for using the cout statement.
Ryan
I do believe that "print the screen" means print the screen to the default printer. Yes you can do it. It takes a lot more code than you are probably ready for though.
This is a sampling of what 'just' writing to the the parallel port involves... it doesn't include reading the video buffer, etc.
Code:#include <conio.h> #include <stdio.h> int _outp( unsigned short port, int databyte ); // This program accepts an input from the user // in decimal and outputs that number as an 8-bit // binary number to the port at 378 hex, usually // LPT1 int main () { int inval = 0; while ( inval < 256) { printf("Enter a value in decimal (256 to quit)>"); scanf("%d", &inval); _outp(0x378, inval); } _outp(0x378, 0); return 0; } http://www.mattjustice.com/parport/par_vc.html
Blue
Or as I like to call it... "The right way." hahahah
Code:#include <iostream> #include <fstream> #include <stdlib> using namespace std ; int main() { char printer[10] = "LPT1:"; char character; ofstream prnt (printer); if (! prnt) { 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); }
Blue