Success - Output to Printer
After much experimenting (I am a novice), I found a way to send the results of a FileName.exe to a printer.
I'm using Borland C++ 4.0 and WIN98. I tried to duplicate the
printer routine using Borland Turbo C++ 3.1 with no success.
The test program:
/* Print2 printer test */
#include <stdio.h>
FILE *prnt;
main()
{
prnt = fopen("LPT1", "w");
fprintf(prnt, "This is a PRINTER test!!!!!\n");
fclose(prnt);
return(0);
}
I selected the Target Type as "Application.exe". And the Platform as "DOS Standard".
I compiled using Project/Make all. When I tried Project/Compile,
the printer would not actvate.
I saved the program and closed all windows. At the MS DOS
prompt, I typed; C:\bc4\bin\FileName.exe and hit Enter.
The Printer activated and produced the desired output.
One problem. Something in the code is causing the printer to take a long time to spit out a copy. But I can manually speed up the output by pressing the paper feed button. The printer functions normally during other operations.
Anybody have a suggestion for a code modification that would speed up the printer???
Thanks for prior help and for any additional help...
Correcting the Printer delay
After much experimenting to fix the very long Printer delay, I
included: fprintf(prnt, "\f"); before the fclose(prnt); statement.
The Printer output now occurs without delay.....
All Smiles now!!
/* "PRINTER OUTPUT TEST" */
#include <stdio.h>
FILE *prnt;
main()
{
prnt = fopen("lpt1", "w");
fprintf(prnt, "\nThis is TEST#1\n");
fprintf(prnt, "This is TEST#2\n");
fprintf(prnt, "This is TEST#3\n");
fprintf(prnt, "This is TEST#4\n");
fprintf(prnt, "\f"); /* Prevents Printer hangup */
fclose(prnt);
return (0);
}