Solved

Printing

Posted on 2002-07-26
7
210 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
Comment Utility
Example:
system("copy test.cpp LPT1:");
0
 
LVL 30

Expert Comment

by:Axter
Comment Utility
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
Comment Utility
Actually, I should have left out the colon.

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


Continue....
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 30

Expert Comment

by:Axter
Comment Utility
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
Comment Utility
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
Comment Utility
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
maze travler 6 47
MFC Model Dialogs 10 57
The dreaded error 1935 with VC++ 2008 Redistributable 12 77
SetCurrentDirectory path limit 7 93
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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.

744 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

10 Experts available now in Live!

Get 1:1 Help Now