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. String to char* problem (varargs related?)

String to char* problem (varargs related?)

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

    I've got an unmanaged varargs function: print(char*, ...); And I've got an exception: catch (System::Exception *ex) And I try to print it: print("%s", ex->Message); And I get 5 weird symbol characters in the output. What's going on? Am I doing something wrong here? I check Message in managed code and it's fine. Print works fine too, for everything else.

    S T 2 Replies Last reply
    0
    • E EssOEss

      I've got an unmanaged varargs function: print(char*, ...); And I've got an exception: catch (System::Exception *ex) And I try to print it: print("%s", ex->Message); And I get 5 weird symbol characters in the output. What's going on? Am I doing something wrong here? I check Message in managed code and it's fine. Print works fine too, for everything else.

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

      Just a guess, maybe it's because ex->Message is in Unicode? And your print function only works on ANSI NULL terminated strings? Regards Senthil _____________________________ My Blog | My Articles | WinMacro

      1 Reply Last reply
      0
      • E EssOEss

        I've got an unmanaged varargs function: print(char*, ...); And I've got an exception: catch (System::Exception *ex) And I try to print it: print("%s", ex->Message); And I get 5 weird symbol characters in the output. What's going on? Am I doing something wrong here? I check Message in managed code and it's fine. Print works fine too, for everything else.

        T Offline
        T Offline
        Tim Zorn
        wrote on last edited by
        #3

        ur char* is probably pointing to sumthing in the memory thats not a string so when u print it it shows u the ascii values of the numbers in the memory give me the complete code and ill tell u wut ur doin wrong

        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