dstPtr[0] = 0;
dstPtr[1] = 0;
dstPtr[2] = 0;
dstPtr[3] = 0;
but can convert it to an int* first and just do
*(int*)dstPtr = 0;
is this correct and is it good practice? Is it the best way to do it?
Thanks,
Michael
Marc
>You may have the wrong ng; this is c#... try c/c++ groups.
C# supports pointers too, you know.
Nothing wrong with casting to an int* first IMO.
Mattias
--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
That's not true. C# can work with pointers no problem. If you've got an
IntPtr you can write code like this
byte* ptr = (byte*) MyIntPtr;
*ptr = 5;
ptr ++;
etc
Michael
I guess I've just tried to avoid "unsafe" except where absolutely necessary,
limiting myself to the safe variations.
But yup, I'll take that on the chin. I was completely wrong.
Marc