PRB: Graphics File Printing Terminates Prematurely

ID: Q23867

6.00 6.00a 6.00ax 7.00 | 1.00 1.50

MS-DOS                 | WINDOWS
kbprg kbprb

The information in this article applies to:

SYMPTOMS

When an application sends graphics files to a printer, printing sometimes ends prematurely. Opening the printer as a binary file does not change the behavior.

CAUSE

The graphics file contains the CTRL+Z character (1Ah) and the printer was opened in "cooked" mode.

RESOLUTION

Use Interrupt 21h Function 44h to set the raw-mode bit for the printer device. In this mode, MS-DOS does not interpret CTRL+Z as the end-of-file character.

MORE INFORMATION

If an application uses the fopen() or open() function to open a device, such as PRN, as a binary file, MS-DOS does not translate carriage return/line feed combinations. However, MS-DOS continues to interpret CTRL+Z as the end-of-file character. In the "raw" mode, MS-DOS does not interpret CTRL+Z in this manner.

The following code example demonstrates setting raw mode from an application in C.

Sample Code

void setrawmode(void)
{
   union REGS inregs, outregs;

   inregs.x.ax = 0x4400;
   inregs.x.bx = 0x04;              // Specify the printer
   int86(0x21, &inregs, &outregs);

   outregs.h.dh = 0x00;
   outregs.h.dl = 0x20;             // Set raw mode bit
   outregs.x.ax = 0x4401;
   int86(0x21, &outregs, &inregs);
}

Additional reference words: 1.00 1.50 6.00 6.00a 6.00ax 7.00 end print KBCategory: kbprg kbprb KBSubcategory: CLngIss Keywords : kb16bitonly

Last Reviewed: July 18, 1997