How can sbyte** be initialized in C# unsafe context?
I need
sbyte** parameters;
to be filled with three s开发者_StackOverflow中文版trings: "first", "second", "third".
Here is a possible solution using byte**
. This should be compatible with sbyte**
as the encoding used is ASCII and only has values to 127.
unsafe static void Main(string[] args)
{
fixed (byte* arg0 = Encoding.ASCII.GetBytes(args[0]),
arg1 = Encoding.ASCII.GetBytes(args[1]),
arg2 = Encoding.ASCII.GetBytes(args[2]))
{
byte*[] arr = { arg0, arg1, arg2 };
fixed (byte** argv = arr)
{
...
}
}
}
精彩评论