PRB: Graphics File Printing Terminates Prematurely

Last reviewed: July 17, 1997
Article 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:

  • Microsoft C for MS-DOS, version 6.0, 6.0a, and 6.0ax
  • Microsoft C/C++ for MS-DOS, version 7.0
  • Microsoft Visual C++ for Windows, versions 1.0 and 1.5

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


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 17, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.