PRB: freopen() Function Fails in QuickWin LibrariesLast reviewed: July 17, 1997Article ID: Q76664 |
7.00 | 1.00 1.50
MS-DOS | WINDOWS
kbprg kbprb
The information in this article applies to:
SYMPTOMSThe freopen() function in the Microsoft C run-time library fails if an application attempts to reassign stdin, stdout, or stderr in a QuickWin window. The sample code below demonstrates this behavior.
CAUSEThis limitation is caused by a design restriction in the QuickWin implementation. QuickWin does not supporting stdin, stdout, or stderr (unlike MS-DOS and OS/2). Because QuickWin assigns all three standard streams to the same file handle, closing one stream affects the others. In MS-DOS and OS/2, each stream has its own file handle that the application can manipulate without affecting the other streams.
RESOLUTIONDo not reassign stdin, stdout, or stderr while in a QuickWin window.
MORE INFORMATION
Sample Code
/* Compile options needed: QuickWin EXE */ #include <stdio.h> #include <process.h>FILE *stream, *errstream;
void main(void){ /* Reassign "stdout" to "data2" */ stream = freopen("data2", "w", stdout); if (stream == NULL ) /* If reassignment failed */ printf("error on freopen\n"); else { fprintf(stream,"This will go to the file `data2'\n"); printf("`stdout' successfully reassigned\n"); fclose(stream); } exit(0);}
|
Additional reference words: 1.00 1.50 7.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |