I have a binary file (text with embedded HP PCL) that I want sent to an operator selected printer. This file is created by an old 'c' program that writes directly to 'PRN' to avoid any OS added data. Here is the old code:
...
...
PrintFile = fopen(PrintFileName, "rb"
while ((ch=fgetc(DataFile)) != EOF)
{
fputc(stdprn,ch);
}
fclose(PrintFile);
...
...
When moving this code to BCB5, I added code to allow the operator to select the printer on which to print the file. Here is the new code:
...
...
if (!PrintDialog1->Execute())
return(-1);
Printer()->BeginDoc();
// WHAT GOES HERE???
Printer()->EndDoc();
...
...
I understand Execute, BeginDoc, EndDoc, etc but I am unsure of how to transfer the binary file data to the spooler. Is there a method in TPrinter that does that? Or do I need to redirect 'cout' to the printer handle? Do I need to process the binary file in a loop as in the old program? or
what else ...
Thanks!
...
...
PrintFile = fopen(PrintFileName, "rb"
while ((ch=fgetc(DataFile)) != EOF)
{
fputc(stdprn,ch);
}
fclose(PrintFile);
...
...
When moving this code to BCB5, I added code to allow the operator to select the printer on which to print the file. Here is the new code:
...
...
if (!PrintDialog1->Execute())
return(-1);
Printer()->BeginDoc();
// WHAT GOES HERE???
Printer()->EndDoc();
...
...
I understand Execute, BeginDoc, EndDoc, etc but I am unsure of how to transfer the binary file data to the spooler. Is there a method in TPrinter that does that? Or do I need to redirect 'cout' to the printer handle? Do I need to process the binary file in a loop as in the old program? or
what else ...
Thanks!