Skip to content

Instantly share code, notes, and snippets.

@Cynede
Created November 6, 2012 07:30
Show Gist options
  • Save Cynede/4023247 to your computer and use it in GitHub Desktop.
Save Cynede/4023247 to your computer and use it in GitHub Desktop.
memcpy, you do it wrong
byte[] cmd = { 0x0F, 0xB1 };
byte [] luas = Encoding.ASCII.GetBytes(luaTextBox.Text);
int newSize = cmd.Length + luas.Length;
using (var ms = new MemoryStream(new byte[newSize], 0, newSize, true, true)) {
ms.Write(cmd, 0, cmd.Length);
ms.Write(luas, 0, luas.Length);
byte[] merged = ms.GetBuffer();
Core.ncon.Send(merged);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment