Unexpected output in your console application when the standard output and error streams are redirected or piped (122442)
The information in this article applies to:
- The C Run-Time (CRT), when used with:
- Microsoft Visual C++ for Windows, 16-bit edition 1.5
- Microsoft Visual C++ for Windows, 16-bit edition 1.51
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 2.1
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
This article was previously published under Q122442 SYMPTOMS
When the standard output and error streams are redirected or piped,
console application output may not be serialized. This can result in
unexpected output.
CAUSE
Although devices as serialized by default, the current Microsoft
CRT implementation does not treat pipes as if they were devices
(due to the potentially high overhead--added code--of doing so.)
Thus, if stderr and stdout refer to the same file or device, and
output is redirected with a pipe, the output will not be serialized.
STATUS
This behavior is by design. The potential for slow execution currently
outweighs the effort necessary to implement pipes such that they are
treated as devices.
Modification Type: | Major | Last Reviewed: | 8/5/2005 |
---|
Keywords: | kbtshoot kbprb KB122442 kbAudDeveloper |
---|
|