Convert .NET Char array to unmanaged C++ char array

Hi,

We are trying to create C++ managed wrapper for our legacy C++ code such that we can use from C#.

The issue is we need to pass an Char array (passed from C# code) to Unmanaged character array.

How do we create a property in the managed wrapper where in it gets/sets the character array (char a[10] ) from C#.

We are successful in using to convert to char* to String vice versa but the issue is how we can do it by fixing the array size.


Thanks for your help.

V



Answer this question

Convert .NET Char array to unmanaged C++ char array

  • rsine


    Hello,

    Perhaps this will help you:
    Pinning an Array

    greetings


  • Convert .NET Char array to unmanaged C++ char array