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. Managed C++/CLI
  4. Help!! Casting a Void*

Help!! Casting a Void*

Scheduled Pinned Locked Moved Managed C++/CLI
helpquestion
4 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.
  • J Offline
    J Offline
    jfk_lili
    wrote on last edited by
    #1

    Hi Guys, I have a void* Message pointer. i wonder how can i print out the content of the memmory which be pointed by the void type pointer. And is there any article introduce about the void* pointer in detail. Thanks very much in advance!

    C 1 Reply Last reply
    0
    • J jfk_lili

      Hi Guys, I have a void* Message pointer. i wonder how can i print out the content of the memmory which be pointed by the void type pointer. And is there any article introduce about the void* pointer in detail. Thanks very much in advance!

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      A void * is a memory address, and you have no idea what is in it. YOu could turn it into a char pointer and thus iterate over the data a byte at a time. But you'll have no idea of it's type, or how long it is. Christian Graus - Microsoft MVP - C++

      J 1 Reply Last reply
      0
      • C Christian Graus

        A void * is a memory address, and you have no idea what is in it. YOu could turn it into a char pointer and thus iterate over the data a byte at a time. But you'll have no idea of it's type, or how long it is. Christian Graus - Microsoft MVP - C++

        J Offline
        J Offline
        jfk_lili
        wrote on last edited by
        #3

        Hi Christian, Thanks verymuch for your help! there should be a string stored in side the memory address. Is it possible i can direct cast the it to a string typ? Many thanks

        S 1 Reply Last reply
        0
        • J jfk_lili

          Hi Christian, Thanks verymuch for your help! there should be a string stored in side the memory address. Is it possible i can direct cast the it to a string typ? Many thanks

          S Offline
          S Offline
          S Senthil Kumar
          wrote on last edited by
          #4

          Yes, you can do a static_cast or a simple C style cast, just make sure you have valid string at the address, otherwise the thing will blow up at runtime. Regards Senthil _____________________________ My Blog | My Articles | WinMacro

          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