private unsafe void button26_Click(object sender, System.EventArgs e)
{
string s = "Hello";
fixed ( char* pc = s )
{
byte * pb = (byte*)pc;
char c1 = *pc;
Console.WriteLine("Char0:"+c1);
char c2 = pc[1];
Console.WriteLine("Char1:"+c2);
Console.WriteLine("byte0:"+pb[0]);
Console.WriteLine("byte1:"+pb[1]);
Console.WriteLine("byte2:"+pb[2]);
Console.WriteLine("byte3:"+pb[3]);
}
}
--
William Stacey, MVP
"Tobias Svensson" <to***@hotmail.com> wrote in message
news:e7**************@tk2msftngp13.phx.gbl...
Hi,
How can I convert a String to a byte * pointer? I am using a third-party
component that has functions that take byte * parameters.
regards Tobias