C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Transfer Printfile from Printserver directly to Printer

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Martin Vogler
Guest





PostPosted: Mon Apr 25, 2005 9:13 am    Post subject: Transfer Printfile from Printserver directly to Printer Reply with 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

Back to top
Jaap Versteegh
Guest





PostPosted: Mon Apr 25, 2005 9:32 am    Post subject: Re: Transfer Printfile from Printserver directly to Printer Reply with quote



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 Wink ) calls that
do not have anything to do with C++ itself.

HTH, Jaap


Back to top
Rolf Magnus
Guest





PostPosted: Mon Apr 25, 2005 9:51 am    Post subject: Re: Transfer Printfile from Printserver directly to Printer Reply with quote



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





PostPosted: Mon May 02, 2005 11:37 am    Post subject: Re: Transfer Printfile from Printserver directly to Printer Reply with quote



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





PostPosted: Mon May 02, 2005 1:14 pm    Post subject: Re: Transfer Printfile from Printserver directly to Printer Reply with quote



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" Smile)
Martin


Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.