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. Is there any way to format and print an UNICODE string in which there are some zero byte?

Is there any way to format and print an UNICODE string in which there are some zero byte?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
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.
  • S Offline
    S Offline
    samfromcn
    wrote on last edited by
    #1

    :confused:i write follow code: WCHAR cnt[100] = L"abc"; WCHAR* p = cnt; wcscpy(p + 50, L"def"); i want print out "abc............def.....",but only get "abc"; "def" was lost. someone may help me to resolve this problem?

    M G 2 Replies Last reply
    0
    • S samfromcn

      :confused:i write follow code: WCHAR cnt[100] = L"abc"; WCHAR* p = cnt; wcscpy(p + 50, L"def"); i want print out "abc............def.....",but only get "abc"; "def" was lost. someone may help me to resolve this problem?

      M Offline
      M Offline
      Milton Karimbekallil
      wrote on last edited by
      #2

      hi BSTR is capable of storing zero byte.. BSTR bs = ::SysAllocString(L"abc\0def" ); is valid. i donno whether it will b a turning point for ur requirment.... try .. for printing and all, i dont think it is possible... unless u write ur own custom printf or wsprintf. rgds...mil10.

      1 Reply Last reply
      0
      • S samfromcn

        :confused:i write follow code: WCHAR cnt[100] = L"abc"; WCHAR* p = cnt; wcscpy(p + 50, L"def"); i want print out "abc............def.....",but only get "abc"; "def" was lost. someone may help me to resolve this problem?

        G Offline
        G Offline
        GDavy
        wrote on last edited by
        #3

        what about: swprintf(outputbuf, L"%s%s", cnt, p+50);

        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