FIX: ostrstreaLast reviewed: September 18, 1997Article ID: Q116447 |
1.00 1.50 | 1.00
MS-DOS | WINDOWS NTkbprg kbfixlist kbbuglist The information in this article applies to:
SYMPTOMSUsing the ostrstream output operator << to pass a literal string containing quotation marks, as shown in the example below, may cause an incorrect translation of the \" sequence. Instead of passing the quotation marks, the backslash is passed into the resultant string as well.
RESOLUTIONThere are two ways to resolve this problem. Both are shown in the sample code in the "MORE INFORMATION" section, below.
STATUSMicrosoft has confirmed this to be a bug in the products listed at the beginning of this article. This problem was corrected in Visual C++ version 2.0.
MORE INFORMATIONYou can use the following sample code to demonstrate the problem:
Sample Code
/* Compile options needed: none */ #include <iostream.h> #include <strstrea.h> char s1[80]; char s2[80]; char s3[80]; void main() { ostrstream(s1,80) << "\"test 1\""; // bad output here cout << s1 << endl; (ostrstream(s2,80)).operator<< ("\"test 2\""); // OK cout << s2 << endl; ostrstream a(s3,80); a << "\"test 3\""; // OK cout << s3 << endl; } |
Additional reference words: 1.00 1.50
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |