Solved

Printing

Posted on 2002-07-26
7
212 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
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
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.

809 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