Quote:
Originally Posted by BelieveGhost
Umm so thats one?
Code:
public unsafe void WriteString(string val)
{
for (int i = 0; i < val.Length; i++)
{
try
{
*((byte*)(Ptr + Count)) = Convert.ToByte(val[i]);
}
catch { }//For weird letters that cannot be converted into byte...
Count++;
}
}
|
(Ptr + Count) points to a memory address that is invalid.
I'm going to guess that
Ptr is a property, so that would be your first issue, although I don't think that's issue here, BUT the
GC is free to do whatever with your pointer when you leave the
fixed scope.
Your problem is most likely that the buffer does not have enough memory allocated for what
Count reaches.
It's a stupid and retarded packet-writer design anyway.
Also if what I said doesn't make sense to you then perhaps you should learn to program.