Solved

Printing

Posted on 2002-07-26
7
211 Views
Last Modified: 2010-04-01
Hi,
1. How to give a print command using ANSI C++?
2. How do I identify whether a printer is connected or not?
0
Comment
Question by:VCGuru
  • 4
7 Comments
 
LVL 30

Accepted Solution

by:
Axter earned 100 total points
ID: 7180248
Example:
system("copy test.cpp LPT1:");
0
 
LVL 30

Expert Comment

by:Axter
ID: 7180280
In DOS, "LPT1:", which is usually your parallel port, can be treated like a file.
So you can open the printer port by use file functions like open, fopen, or ofstream.
Then you can write to it just as you would to a file.
To open the port just use "LPT1" as the file name. If your printer is connected to parallel port 2 or 3, then use "LPT2:" or "LPT3:".

What is your OS, and what is your compiler?
0
 
LVL 30

Expert Comment

by:Axter
ID: 7180317
Actually, I should have left out the colon.

Example:
system("copy test.cpp LPT1");


Continue....
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 30

Expert Comment

by:Axter
ID: 7180349
If you want to print to a network printer, you can use the "Net Use" command.

Example:
//Remove any previous connections to LPT3
system("net use LPT3: /del");

//Connect to printer called dale on 'scsetbprt01.axter.com' server to port LPT3
system("NET USE LPT3: \\\\scsetbprt01.scsnet.csc.com\\dale");
0
 
LVL 11

Expert Comment

by:griessh
ID: 7378464
Dear VCGuru

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "Axter"

comment(s) as an answer.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7420061
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

911 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now