Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. I have problem with codecvt<>

I have problem with codecvt<>

Scheduled Pinned Locked Moved ATL / WTL / STL
helpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Cold_Fearing_Bird
    wrote on last edited by
    #1

    locale loc("chs");
    mbstate_t mystate;
    char origin[] = "追求追求";
    wchar_t dest[9] = { 0 };
    const char * pc;
    wchar_t * pwc;

    const codecvt& myfacet =
    use_facet >(loc);

    codecvt<>.in() translates char into wchar_t characters, but the first letter of origin[] is always translated wrong,the remaining characters are fine. could someone help me out?

    M 1 Reply Last reply
    0
    • C Cold_Fearing_Bird

      locale loc("chs");
      mbstate_t mystate;
      char origin[] = "追求追求";
      wchar_t dest[9] = { 0 };
      const char * pc;
      wchar_t * pwc;

      const codecvt& myfacet =
      use_facet >(loc);

      codecvt<>.in() translates char into wchar_t characters, but the first letter of origin[] is always translated wrong,the remaining characters are fine. could someone help me out?

      M Offline
      M Offline
      Madhu Nair 0
      wrote on last edited by
      #2

      Cold_Fearing_Bird wrote:

      char origin[] = "追求追求";

      You are trying to set a unicode/wide string to ANSI buffer.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups