-
Help with printing
Hi,
You see i have problem wit using the printer in c++. What i want to do, is print a text file to a printer using c++. I know that i have to use the system() function, as so "system("print <file>");
but i have a problem..
Im using a network printer, what exactly do i have to type after "print". People are telling me to type server name and printer location, but i have no idea how to do that or where to get the information from. Some one please tell me how do this and where to get the info from. Thanks
-
Have you try type in MS DOS -> help print
All commands with System are console commands!
So all you can do with System() look into ms dos and type help and you will get all what you can do!
Then you will get something like this
Code:
c:\>help print
prints a text file.
PRINT [/D:device] [[drice:][path]filename[...]]
/D: device Specifies a print device
-
OK, I am kindof hijacking this guys thread. I am not as familiar with C++ as with C but can you not just reassign streams as with C to force output to go to the printer vice console, or just simply associate cout with the printer? I found an overloaded cout on msdn but it was overly complex for basic printer ops.
Say I want to print a txt file in C++. Can I not simply send the output to the printer stream and not worry about all the low level printer stuff? (I'm talking basics here) I know this can be accomplished in C a number of ways.
PS - sorry to hijack your thread but you may also gain some knowledge from this.
[edit]
Alright, let me rephrase this. How do you do this:
Code:
int main(void){
FILE* stream;
stream = fopen("PRN", "w");
fprintf(stream, "This goes to the printer\n");
fclose(stream);
return 0;
}
in C++?
[/edit]
-Andy