string[] to byte ** / sbyte ** and byte ** / sbyte ** to string[] for example? #85740
-
Hello everyone, I would like to know how do I convert Do you have idea with double pointers to string[] args Because sometimes
Program pass with Example with
A Method I have problem with multiple arrays or pointers. How do I know like this? Can you help me if you have ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 15 replies
-
Here is an example where we do something similar in this repo: The idea is to allocate the converted strings in native memory. It is necessary to free them once you are done with it. |
Beta Was this translation helpful? Give feedback.
Either allocate array of pointers
sbyte*[] sArgs = new sbyte*[args.Length];
and pin it using fixed;or allocate native memory using
sbyte** sArgs = (sbyte**)NativeMemory.Alloc(args.Length * sizeof(sbyte*));
and then free it usingNativeMemory.Free
once you are done with it.