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. C / C++ / MFC
  4. Unicode Strings

Unicode Strings

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++json
3 Posts 3 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.
  • U Offline
    U Offline
    user3034
    wrote on last edited by
    #1

    Hi, My C++ program (VS2005) has two parts. one part writes into a file and the other part reads from it. The folder name is japanese. eg: C:\Documents and Settings\管理者 To read the file in this location,I am supposed to use an API (third party library) which takes the file location as a char*. I have the file location(C:\Documents and Settings\管理者) in a CString. How do I convert this into a char* ? I tried using the T2A macros, but the japanese string is not getting extracted. the char* pointer shows some junk charaters. Any inputs on this ? Thanks in advance.

    S 1 Reply Last reply
    0
    • U user3034

      Hi, My C++ program (VS2005) has two parts. one part writes into a file and the other part reads from it. The folder name is japanese. eg: C:\Documents and Settings\管理者 To read the file in this location,I am supposed to use an API (third party library) which takes the file location as a char*. I have the file location(C:\Documents and Settings\管理者) in a CString. How do I convert this into a char* ? I tried using the T2A macros, but the japanese string is not getting extracted. the char* pointer shows some junk charaters. Any inputs on this ? Thanks in advance.

      S Offline
      S Offline
      Sarath C
      wrote on last edited by
      #2

      It's better to seek the help of 3rd party library to provide Unicode interfaces. Other workarounds like renaming to ASCII and restoring it back after use will be painful.

      -Sarath. "Great hopes make everything great possible" - Benjamin Franklin

      My blog - Sharing My Thoughts

      S 1 Reply Last reply
      0
      • S Sarath C

        It's better to seek the help of 3rd party library to provide Unicode interfaces. Other workarounds like renaming to ASCII and restoring it back after use will be painful.

        -Sarath. "Great hopes make everything great possible" - Benjamin Franklin

        My blog - Sharing My Thoughts

        S Offline
        S Offline
        Supriya Tonape
        wrote on last edited by
        #3

        I m not sure but check if this helps you, CString buf = _T("salut"); //the first string char * Result; //the result long len = wcslen (buf); //the length of "salut" wcstombs (Result,buf,len); //conversion to char * Result[len] = '\0';

        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