Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Unicode string literals support <a href="http://gcc.gnu.org/projects/cxx0x.html" rel="nofollow">began</a> in GCC 4.5. Maybe that's the problem.</p> <p><strong>[edit]</strong></p> <p>After some digging I've found that streams for this new unicode literals are described in <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2035.pdf" rel="nofollow">N2035</a> and it was <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2870.html" rel="nofollow">included</a> in a draft of the standard. According to this document you need <code>u32ofstream</code> to output you string but this class is absent in GCC 4.5 C++0x library.</p> <p>As a workaround you can use ordinary fstream:</p> <pre><code>std::ofstream fout2("output2.txt", std::ios::out | std::ios::binary); fout2.write((const char *)str.c_str(), str.size() * 4); </code></pre> <p>This way I've output your string in UTF-32LE on my Intel machine (which is little-endian).</p> <p><strong>[edit]</strong></p> <p>I was a little bit wrong about the status of <code>u32ofstream</code>: according to the <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf" rel="nofollow">latest draft</a> on the The C++ Standards Committee's <a href="http://www.open-std.org/jtc1/sc22/wg21/" rel="nofollow">web site</a> you have to use <code>std::basic_ofstream&lt;char32_t&gt;</code> as you did. This class would use <code>codecvt&lt;char32_t,char,typename traits::state_type&gt;</code> class (see end of §27.9.1.1) which has to be implemented in the standard library (search <code>codecvt&lt;char32_t</code> in the document), but it's not available in GCC 4.5.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload