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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. data conversion

data conversion

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

    How can I convert a String* data to char*? Is it possible to do Type convertion between managed type and unmanaged type. Is there any article which gives an explanation on this type conversion? Please help. vini

    S 1 Reply Last reply
    0
    • V vin

      How can I convert a String* data to char*? Is it possible to do Type convertion between managed type and unmanaged type. Is there any article which gives an explanation on this type conversion? Please help. vini

      S Offline
      S Offline
      Selvam R
      wrote on last edited by
      #2

      Hello, char* str= (char*)Marshal::StringToHGlobalAnsi("Hello World"); With Regards, R.Selvam

      V 1 Reply Last reply
      0
      • S Selvam R

        Hello, char* str= (char*)Marshal::StringToHGlobalAnsi("Hello World"); With Regards, R.Selvam

        V Offline
        V Offline
        vin
        wrote on last edited by
        #3

        Thanks. But now I get an error " error C2440: 'type cast' : cannot convert from 'System::IntPtr' to 'char *' ". Pls help. vini

        S 1 Reply Last reply
        0
        • V vin

          Thanks. But now I get an error " error C2440: 'type cast' : cannot convert from 'System::IntPtr' to 'char *' ". Pls help. vini

          S Offline
          S Offline
          Selvam R
          wrote on last edited by
          #4

          Hello, look this, http://www.codeproject.com/dotnet/managed_unmanaged.asp With Regards, R.Selvam

          V 2 Replies Last reply
          0
          • S Selvam R

            Hello, look this, http://www.codeproject.com/dotnet/managed_unmanaged.asp With Regards, R.Selvam

            V Offline
            V Offline
            vin
            wrote on last edited by
            #5

            R.selvam wrote: _Hello, look this, http://www.codeproject.com/dotnet/managed\_unmanaged.asp_ Thanks very much. But now I get another error when I include the namespace System::Runtime::InteropServices. error C2872: 'FILETIME' : ambiguous symbol could be 'D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinDef.h(354) : _FILETIME FILETIME' or 'stdafx.cpp(0) : System::Runtime::InteropServices::FILETIME'. Kindly help. Vini

            1 Reply Last reply
            0
            • S Selvam R

              Hello, look this, http://www.codeproject.com/dotnet/managed_unmanaged.asp With Regards, R.Selvam

              V Offline
              V Offline
              vin
              wrote on last edited by
              #6

              Now its fine. I changed my function call to IntPtr ip=System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi("hello World"), instead of including the namespace in the using namespace stmt and then calling the function as IntPtr ip=Marshal::StringToHGlobalAnsi("Hello World"). Thanks for the help Vini

              S L 2 Replies Last reply
              0
              • V vin

                Now its fine. I changed my function call to IntPtr ip=System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi("hello World"), instead of including the namespace in the using namespace stmt and then calling the function as IntPtr ip=Marshal::StringToHGlobalAnsi("Hello World"). Thanks for the help Vini

                S Offline
                S Offline
                Selvam R
                wrote on last edited by
                #7

                Hi, :) Np. With Regards, R.Selvam

                1 Reply Last reply
                0
                • V vin

                  Now its fine. I changed my function call to IntPtr ip=System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi("hello World"), instead of including the namespace in the using namespace stmt and then calling the function as IntPtr ip=Marshal::StringToHGlobalAnsi("Hello World"). Thanks for the help Vini

                  L Offline
                  L Offline
                  leppie
                  wrote on last edited by
                  #8

                  Now this is exactly why i like a preprocessor :) leppie::AllocCPArticle("Zee blog");
                  Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.

                  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