Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending file to printer 1

Status
Not open for further replies.

biot023

Programmer
Nov 8, 2001
403
GB
I've sent to printers in C (long, long ago) & was wondering if it is as simple in C++? Would I just open a stream to the printer file, and what is it called? LPT1?

Any help gratefully appreciated.

Douglas JL

If it don't make you laugh, it ain't true.
 
This works with streams:
Code:
std::ofstream SOFile; // stream set up
//SOFile.open("Label.dat");      // For Testing
SOFile.open("LPT1:");

if (!SOFile)
{
    // Something went wrong
    // Put some error code here
}
else
{
    // Print to file
    SOFile << &quot;This is printed&quot; << std::endl;
}

There are more ways than this but this does work. James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.
 
Thanks alot, man - just what I'm looking for.

Douglas JL If it don't make you laugh, it ain't true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top