-
Printing.
I know this has been asked plenty of times before, perhaps I don't know what to look for or something, but I can't find anything on it. How can I print with C++? I mean printing for character mode, printing what you seen on the screen on a paper. Thank.
-
Maybe something like
Code:
ofstream os("PRN");
if (!os)
{
cout <<"Error" <<endl;
}
else
{
os <<"message" <<flush;
os.close();
}
-
I mean printing to a printer (the actual thing), from within command prompt.
-
>>I mean printing to a printer (the actual thing), from within command prompt.<<
Yeah... like I showed :confused:
Of source, the printer needs to be on the end of LPT1 (parallel port). And PRN might not be the right keyword (search the forums for more).
If you're in Windows, and you want to use the Windows print management system, you'll need to refer to MSDN to find the correct API and methods to use.
-
Code:
#include <iostream>
#include <fstream>
using namespace std;
int main(void)
{
cout<<"Printing from Command Prompt";
ofstream print("LPT1");
print<<"I love computer programming"<<flush;
print.close();
return 0;
}
Any idea why it's not printing?
-
is it a USB printer? then you'll have problems... if it's on a parallel port, use the link below to help you out... use it either way, actually...
check here: http://cboard.cprogramming.com/showt...put+to+printer