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. unsigned char* to const char*

unsigned char* to const char*

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

    Hello dear friends, How to convert unsigned char* to const char*. Thanks in advance to all of you.

    ritz1234

    M R 2 Replies Last reply
    0
    • R ritz1234

      Hello dear friends, How to convert unsigned char* to const char*. Thanks in advance to all of you.

      ritz1234

      M Offline
      M Offline
      Mukesh Kumar
      wrote on last edited by
      #2

      Try this unsigned char *chr = Some_value; const char *ch = (const char *)chr; You sholud also use Google sometimes...:)

      Mukesh Kumar Software Engineer

      1 Reply Last reply
      0
      • R ritz1234

        Hello dear friends, How to convert unsigned char* to const char*. Thanks in advance to all of you.

        ritz1234

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

        Why do you need this conversion? What are you trying to achieve? I am asking this because the 'const'ness would matter much, only if you are trying to cast the const away. Are you trying to pass an unsigned char* to a function that expects a const char*? There's no harm in that case, because you are merely providing a modifiable value to a function which promisingly will not modify the value given to it. You also need to know the possible loss of data that might occur while converting between signed and unsigned datatypes.

        Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

        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