The information in this article applies to:
SYMPTOMSThe following article in the Microsoft Knowledge Base: Q11988 INFO: Windows File I/O vs. C Run-time File I/Ostates that "An application should use the OpenFile() API any time an MS- DOS file handle is required. The open functions do not necessarily open a file in binary raw mode; the application is required to set the binary attribute explicitly. The OpenFile() function automatically performs this step." This is indeed the case when the target of OpenFile is a file. However, under the 16-bit subsystems of Windows NT 4.0 and Windows 95, any attempts to open a local printer using OpenFile("LPTx", ...) will invariably set the output stream for cooked mode. RESOLUTIONTo work around this, explicitly set the stream for raw mode as follows: Sample Code
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATIONSteps to Reproduce Behavior
ResultThe number of bytes output to the printer (nBytesWritten) will be less than the size of the buffer (sizeof(Buf)). Specifically, the stream will be truncated immediately following the initial CTRL-Z.Expected ResultThe number of bytes output to the printer (nBytesWritten) will be equal to the size of the buffer (sizeof(Buf)).Additional query words:
Keywords : kb16bitonly kbAPI kbKernBase kbNTOS400 kbWinOS2000 kbWinOS95 kbDSupport kbGrpKernBase |
Last Reviewed: January 10, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |