FIX: ostrstream output operator may cause incorrect translation of \" (116447)
The information in this article applies to:
- Microsoft Visual C++ 1.5
- Microsoft Visual C++ 1.0
This article was previously published under Q116447 SYMPTOMS
Using 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.
RESOLUTION
There are two ways to resolve this problem. Both are shown in the sample
code in the "MORE INFORMATION" section, below.
- Use the operator keyword to call the << member function directly:
(ostrstream(string,length)).operator<< ("\"quoted string\"")
-or-
- Create an object of type ostrstream, then use the object to call
the << operator:
ostrstream a(string,length);
a << "\"quoted string\""
STATUS
Microsoft 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.
Modification Type: | Major | Last Reviewed: | 2/6/2004 |
---|
Keywords: | kbbug kbfix kbLangCPP KB116447 kbAudDeveloper |
---|
|