473,396 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Transfer Printfile from Printserver directly to Printer

Hi Guys,
Is there anybody, who can tell me how I can simulate the DOS Command:
Copy filename LPT1
in C++ ?
I have tryed it with the READFILE and WRITEPRINTER commands, but i#ll
get only chunk on the paper.
thanks for any comment
M. Vogler

Jul 23 '05 #1
4 2315
> Hi Guys,
Is there anybody, who can tell me how I can simulate the DOS Command:
Copy filename LPT1
in C++ ?
I have tryed it with the READFILE and WRITEPRINTER commands, but i#ll
get only chunk on the paper.
thanks for any comment
M. Vogler


If you want to invoke the DOS shell I think you will need the "system" call.

I don't know about 'simulating' it, but I think that is off topic here
anyway since it involves dos API (if you can speak of that ;) ) calls that
do not have anything to do with C++ itself.

HTH, Jaap

Jul 23 '05 #2
Martin Vogler wrote:
Hi Guys,
Is there anybody, who can tell me how I can simulate the DOS Command:
Copy filename LPT1
in C++ ?


#include <fstream>

int main()
{
std::ifstream file("filename");
std::ofstream lpt("LPT1");
char c;
while (file.get(c) && lpt.put(c));
}

It will probably be more efficient if you don't copy each character on its
own, but instead read/write in blocks.

Jul 23 '05 #3


Rolf Magnus schrieb:
Martin Vogler wrote:

Hi Guys,
Is there anybody, who can tell me how I can simulate the DOS Command:
Copy filename LPT1
in C++ ?

#include <fstream>

int main()
{
std::ifstream file("filename");
std::ofstream lpt("LPT1");
char c;
while (file.get(c) && lpt.put(c));
}

It will probably be more efficient if you don't copy each character on its
own, but instead read/write in blocks.

Thanks Rolf for the code, but it doesn't work and I don't know why. I
think I'm to silly to code the problem correctly.
I tried it with two files and it worked but with file and printer
nada:-((( Maybe there is another reason, i code on a laptop without a
parallell port.

Greetings Martin
Jul 23 '05 #4


Rolf Magnus schrieb:
Martin Vogler wrote:

Hi Guys,
Is there anybody, who can tell me how I can simulate the DOS Command:
Copy filename LPT1
in C++ ?

#include <fstream>

int main()
{
std::ifstream file("filename");
std::ofstream lpt("LPT1");
char c;
while (file.get(c) && lpt.put(c));
}

It will probably be more efficient if you don't copy each character on its
own, but instead read/write in blocks.

Rolf Thausend Thanks, now it works pretty good. I've only to tell LPT1
which netprinter I want:
net use LPT1 \\server\printername. In Austria we will say now: "runs
like a bell" :-))
Martin

Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Karlheinz Klingbeil | last post by:
I have deonwloaded and tested reportlab, which seems to be good enough for my needs with printing reports, formatted text and such things. But i have a question: I have not seen any hint in...
2
by: Marc Champagne | last post by:
Hi folks, I wish to print on pre-printed continuous forms on a dot matrix printer. My initial intent was to access to printer directly (in raw mode, somehow) in order to send whatever is...
5
by: Tom | last post by:
I am converting an old application that was printing directly to a specialized printer device (i.e. a special label printer). It was doing this by opening a file with the file path of 'LPT1:' and...
1
by: notregister | last post by:
ref : article ID 298141 Hi i have implement this part into my program, how do i recieve information whether the printer has printed out correctly so that i can carry on to my next phase? is...
11
by: E.T. Grey | last post by:
Hi, I have an interesting problem. I have a (LARGE) set of historical data that I want to keep on a central server, as several separate files. I want a client process to be able to request the...
0
by: Mike9900 | last post by:
We are developing a point of sale software and need to work with receipt printers. We need to send texts to the printer directly in desired fonts. We are able to send texts to the printer using...
1
by: --[zainy]-- | last post by:
AA Guyz i am using C#.Net 2003 for my project. I want to print report directly to printer. Keep in mind that i am getting report criteria from form and viewing report in crystal report viewer.....
2
alpnz
by: alpnz | last post by:
Hi, I am involved with a labelling application, which at the moment prints labels on thermal printers, via the windows driver. This can be frustratingly slow. Most thermal printers have an ASCII...
3
by: Antoon Pardon | last post by:
On 2008-09-16, Graham Jenkins <graham@vpac.orgwrote: What about systems that don't use cups for printing? -- Antoon Pardon
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.