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

unicode

Scheduled Pinned Locked Moved C / C++ / MFC
data-structuresquestion
6 Posts 4 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.
  • M Offline
    M Offline
    manu_2205
    wrote on last edited by
    #1

    Hi I have a array of WCHAR type and my data is in buffer in unicode format whenever i try to read byte from buffer it add some nonprintable character at last . And if i try to read byte in char array it just display only first character. what is the reason

    manu

    R 1 Reply Last reply
    0
    • M manu_2205

      Hi I have a array of WCHAR type and my data is in buffer in unicode format whenever i try to read byte from buffer it add some nonprintable character at last . And if i try to read byte in char array it just display only first character. what is the reason

      manu

      R Offline
      R Offline
      Rage
      wrote on last edited by
      #2

      post some code ? Probably your end of string char does not match.

      M 1 Reply Last reply
      0
      • R Rage

        post some code ? Probably your end of string char does not match.

        M Offline
        M Offline
        manu_2205
        wrote on last edited by
        #3

        WCHAR *m_pbytTemp=new WCHAR[From-To+1]; memset(m_pbytTemp,0x0,From-To); memcpy(m_pbytTemp,&m_pbytFileBuffer[To],From-To); m_pbytTemp[From-To]=L'\0';

        manu

        R 1 Reply Last reply
        0
        • M manu_2205

          WCHAR *m_pbytTemp=new WCHAR[From-To+1]; memset(m_pbytTemp,0x0,From-To); memcpy(m_pbytTemp,&m_pbytFileBuffer[To],From-To); m_pbytTemp[From-To]=L'\0';

          manu

          R Offline
          R Offline
          Rajesh R Subramanian
          wrote on last edited by
          #4

          manu_2205 wrote:

          memset(m_pbytTemp,0x0,From-To); memcpy(m_pbytTemp,&m_pbytFileBuffer[To],From-To);

          memset(m_pbytTemp,0x0,From-To); Use wmemset()while working with Unicode! memcpy(m_pbytTemp,&m_pbytFileBuffer[To],From-To); Similarly use wmemcpy()!


          Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

          M 1 Reply Last reply
          0
          • R Rajesh R Subramanian

            manu_2205 wrote:

            memset(m_pbytTemp,0x0,From-To); memcpy(m_pbytTemp,&m_pbytFileBuffer[To],From-To);

            memset(m_pbytTemp,0x0,From-To); Use wmemset()while working with Unicode! memcpy(m_pbytTemp,&m_pbytFileBuffer[To],From-To); Similarly use wmemcpy()!


            Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

            M Offline
            M Offline
            manu_2205
            wrote on last edited by
            #5

            But m_pbytFileBuffer is of Byte *(to hold the bytes)

            manu

            D 1 Reply Last reply
            0
            • M manu_2205

              But m_pbytFileBuffer is of Byte *(to hold the bytes)

              manu

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              Then shouldn't you be using something like W2A()?


              "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

              "Judge not by the eye but by the heart." - Native American Proverb

              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