Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 213
  • Last Modified:

Network Printers

Ok, I was asked this question and I didn't know the answer.  How do you print to a network printer using ostream?

This code works:
#include<fstream.h>
int main()
{
        ofstream printer ("prn");
        printer << "This line is on the printer\n";
        return 0;
}

works OK if the printer is attached to LPT1, but does not print on the
network printer
\\wchs\hp4000_wchs_g129

Thanks for your help
0
trip42
Asked:
trip42
1 Solution
 
nietodCommented:
You should be able to specify the network path to the ofstream, like

    ofstream printer ("\\\\wchs\\hp4000_wchs_g129");

Note that each "\" is expressed as two "\"s in the string.  That should work fine.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now