Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


using c++ DLL with template class

NoiK00NoiK00 Member Posts: 4

I've recently tried to use an existing C++ library.. Now i was trying to test test the library but i


  • NoiK00NoiK00 Member Posts: 4
    i think i have narrowed down the question:

    When using the function:
    std::string CTPGKIXOption3::MakeKIX(const std::string& strAddress, const std::string& strPostalCode)

    and i use REAL std::strings it all works fine. But when i use a String^ converted to a std::string it gives a debug error. the error states string Subscript out of range.

    the function used for conversion is:
    [code] void MarshalString( String ^ s, std::string& os ) {
    using namespace Runtime::InteropServices;
    const char* chars =
    (const char*)(Marshal::StringToHGlobalAnsi(s)).ToPointer();
    os = chars;
    What is going wrong in the conversion?

Sign In or Register to comment.