Need FIX: std::wofstream Can't Output After DBCS Character Is Output (Q274012) 
Author Message
 Need FIX: std::wofstream Can't Output After DBCS Character Is Output (Q274012)

I found the following in MSDN.
Though I am now using VC6 + SP5, I still encountered this. And then I turned
to the new VS.NET, but I was beated again. I need help. Thanks.

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

The information in this article applies to:

Microsoft Visual C++, 32-bit Enterprise Edition, version 6.0
Microsoft Visual C++, 32-bit Professional Edition, version 6.0
Microsoft Visual C++, 32-bit Learning Edition, version 6.0

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 << 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. */


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:
Q194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why
Q194295 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:

Microsoft has confirmed this to be 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.

PublishedSep 22 2000 2:11PM Issue Typekbbug
Last ModifedJul 14 2001 4:25AM Additional Query Wordsstd::wofstream DBCS
KeywordskbSTL kbVC600 kbVC600QFE kbDSupport kbGrpDSVCCompiler

Mon, 30 Aug 2004 14:02:28 GMT  
 [ 1 post ] 

 Relevant Pages 

1. STD::LIST output

2. Unicode via wofstream: What am I doing wrong?

3. Newbie: redirectiond std output

4. Redirecting std output with CreateProcess DOS command

5. input, output, input/output parameters?????

6. Differences between C programs output and win outputs

7. ANSI C Run Time Erroe to output data to the output file

8. VC 5 TRACE output to a file instead of the output window

9. How to add output to VC6 output pane?

10. Output to build tab of DevStudio output window

11. Scrolling Output via Curses (output from other processes)

12. Outputting DOS program output to a MFC window


Powered by phpBB® Forum Software