How to convert a System::String^ to a char*

This is a discussion on How to convert a System::String^ to a char* within the Windows Programming forums, part of the Platform Specific Boards category; I have an existing program written in 'C' that I would like to add a UI to. I'm currently using ...

  1. #1
    Registered User
    Join Date
    Feb 2014
    Posts
    12

    How to convert a System::String^ to a char*

    I have an existing program written in 'C' that I would like to add a UI to. I'm currently using C++ in Visual Studio to do it, with an
    Code:
    extern "C" {make things go}
    to hold the original 'C' code.

    The problem is that the 'C' code requires a char * and the value from the UI textbox outputs a System::String type.

    How can I convert the value from 'C++' 'textBox1->Text' (System::String) to a 'C' 'char * user_input'?

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    2,590
    I found this great link that explains exactly how to do that.
    Code:
    namespace life
    {
        const bool change = true;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Convert string to char or use 2d array of char?
    By simpleblue in forum C++ Programming
    Replies: 6
    Last Post: 09-25-2011, 06:00 PM
  2. Replies: 11
    Last Post: 06-16-2011, 12:59 PM
  3. Replies: 2
    Last Post: 09-12-2010, 10:15 AM
  4. convert char** (c string array) to std::string[]
    By umen242 in forum C++ Programming
    Replies: 2
    Last Post: 11-11-2008, 05:52 AM
  5. Cannot convert system object to system string?
    By Robert_Sitter in forum Windows Programming
    Replies: 0
    Last Post: 11-18-2005, 02:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21