FIX: std::wofstream Can't Write to a File After DBCS Character Is Written to a File

Article translations Article translations
Article ID: 274012 - View products that this article applies to.
This article was previously published under Q274012
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

SYMPTOMS

No text appears after a double-byte character set (DBCS) character is written to a file.

For instance, in the following code snippet, the text " There" is not written to the STLout.txt file after the DBCS character 0x30F0 is written to a file.
#include <fstream>

void main()
{
  wchar_t ch = 0x30F0; /* DBCS Japanese test character. */ 
  std::wofstream wfout;
  wfout.imbue(std::locale("Japanese"));
  wfout.open("STLout.txt");
  wfout << L"Hello";
  wfout << ch;  /* Write the DBCS character to the output text file. */ 
  //wfout.clear(); /* Workaround: Call clear() after the DBCS output. */ 
  wfout << L" There\n";  /* This is not written to the output text file. */ 
}
				

RESOLUTION

To resolve this problem, obtain the latest Service Pack for Visual Studio 6.0. For additional information about Visual Studio service packs, click the article numbers below to view the articles in the Microsoft Knowledge Base:
194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why
194295 HOWTO: Tell That a Visual Studio Service Pack Is Installed
You can download the latest Visual Studio service pack from the following Microsoft Web site:
http://msdn2.microsoft.com/en-us/vstudio/Aa718353.aspx

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Visual Studio 6.0 Service Pack 5.

Properties

Article ID: 274012 - Last Review: February 28, 2014 - Revision: 2.3
APPLIES TO
  • Microsoft Visual C++ 6.0 Enterprise Edition
  • Microsoft Visual C++ 6.0 Professional Edition
  • Microsoft Visual C++, 32-bit Learning Edition 6.0
Keywords: 
kbnosurvey kbarchive kbbug kbfix kbqfe kbstl kbhotfixserver KB274012

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com