Solved

Network Printers

Posted on 1998-06-19
1
195 Views
Last Modified: 2010-04-01
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
Comment
Question by:trip42
1 Comment
 
LVL 22

Accepted Solution

by:
nietod earned 50 total points
ID: 1166318
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
returning a dereferenced pts in C++ 10 157
Excel/Word Add-in in what language? 5 127
thread-safe code in c++ 2 115
Android development question 2 51
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question