can anybody tell me the command to print out a variable straight to the printer please.
p.s (not 'print screen' or 'screen dumps')
thanks.
can anybody tell me the command to print out a variable straight to the printer please.
p.s (not 'print screen' or 'screen dumps')
thanks.
Which OS/Compiler?
What type of printer, and what sort of port is it plugged into?
What type of program - console or GUI ?
I came across thisOriginally Posted by dac
http://support.microsoft.com/default...kb;en-us;23976
"Service of the poor and destitutes is the service of the God"
Normative Changes to ISO/IEC 9899:1990 in Technical Corrigendum 1
Incompatibilities Between ISO C and ISO C++
im using dev-C++, this is for my AS level coursework project! 'village hall'. have XP at home but NT at school, so needs to work on both.
using the DOS box.
i just need a command which can print my variable text to a printer (reciept).
I am trying to do the same thing. I have tried those tips and nothing happens. These are the codes that I have tried
Code:#include <stdio.h> #include <iostream> using namespace std; int main() { FILE *stream; stream = fopen("LPT1", "w"); fprintf(stream, "a line of text\n"); fclose(stream); cin.get(); return 0; }
none of these work for me. no errors just nothing prints. I know the printer is working right because I tested it.Code:#include <iostream> #include <fstream> using namespace std; int main() { ofstream printer("lpt1"); printer << "a line of text\f" << flush; cin.get(); return 0; }
Using DEV-C++ under Windows XP
With an HP Deskjet Printer on lpt1
Does this work?none of these work for me. no errors just nothing prints. I know the printer is working right because I tested it.
If so, you can just redirect the output of your program from the command line:Code:C:\>echo Hello, World! > lpt1
BTW, some compilers define a stream called stdprn.Code:C:\>program > lpt1
Code:fprintf(stdprn, "a line of text\n");
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.