 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Martin Vogler Guest
|
Posted: Mon Apr 25, 2005 9:13 am Post subject: 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
|
|
| Back to top |
|
 |
Jaap Versteegh Guest
|
Posted: Mon Apr 25, 2005 9:32 am Post subject: Re: Transfer Printfile from Printserver directly to Printer |
|
|
| Quote: | 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
|
|
| Back to top |
|
 |
Rolf Magnus Guest
|
Posted: Mon Apr 25, 2005 9:51 am Post subject: Re: Transfer Printfile from Printserver directly to Printer |
|
|
Martin Vogler wrote:
| Quote: | 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.
|
|
| Back to top |
|
 |
Martin Vogler Guest
|
Posted: Mon May 02, 2005 11:37 am Post subject: Re: Transfer Printfile from Printserver directly to Printer |
|
|
Rolf Magnus schrieb:
| Quote: | 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
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
|
|
| Back to top |
|
 |
Martin Vogler Guest
|
Posted: Mon May 02, 2005 1:14 pm Post subject: Re: Transfer Printfile from Printserver directly to Printer |
|
|
Rolf Magnus schrieb:
| Quote: | 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
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 \serverprintername. In Austria we will say now: "runs
like a bell" )
Martin
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|