VCGuru
asked on
Printing
Hi,
1. How to give a print command using ANSI C++?
2. How do I identify whether a printer is connected or not?
1. How to give a print command using ANSI C++?
2. How do I identify whether a printer is connected or not?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Actually, I should have left out the colon.
Example:
system("copy test.cpp LPT1");
Continue....
Example:
system("copy test.cpp LPT1");
Continue....
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 ");
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
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
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
Force accepted
** Mindphaser - Community Support Moderator **
** Mindphaser - Community Support Moderator **
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?