-
How to print using C++
Hi. For all those who know BASIC, you might remember there is an LPRINT statement that is used to print a line on paper.
e.g. LPRINT "Hello World" would print "Hello World" on paper using the printer.
Is there a similar statement/function which does this in C++?
-
Code:
#include <cstdio>
int main(){
FILE* fout = fopen("LPT1","w");
if(fout){
fprintf(fout,"Poor man's printout\f");
fclose(fout);
}
return 0;
}
-
Note:LPT1 is the DOS device for the 1st printer port.I guess you could access other devices like this-?