Output to stdprn Is in Binary (Untranslated) ModeID: Q68944
|
The 16-bit C start-up code automatically opens five files for a program's
use. The "stdprn" file (PRN device) is opened in binary mode, which is
important to remember when printing to printers that require a
carriage return/line feed combination to end a line (for example, some
laser printers). In those cases, you do one of the following:
The following is a code fragment that illustrates each method:
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
void main(void)
{
FILE *txtprn;
fprintf(stdprn, "untranslated\n"); // Standard mode
fprintf(stdprn, "CRLF pair added \n\r"); // Method 1
txtprn=freopen("PRN", "wt",stdprn); // Method 2
fprintf(txtprn, "translated\n");
fflush(stdprn); // Flush the buffer first
setmode(fileno(stdprn), O_TEXT); // Method 3
fprintf(stdprn, "translated\n");
}
Additional query words: kbinf 5.10 6.00 6.00a 6.00ax 7.00 1.00 1.50
Keywords : kb16bitonly
Version :
Platform :
Issue type :
Last Reviewed: July 21, 1999