Skip to content

Instantly share code, notes, and snippets.

@wislon
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wislon/21af31935e293e325dca to your computer and use it in GitHub Desktop.
Save wislon/21af31935e293e325dca to your computer and use it in GitHub Desktop.
Write int32 to binary file
/*stick this in linqpad and then open the resulting file in a hex editor (or sublime text)*/
Int32 bob = 640036;
using (var fs = new FileStream("d:\\temp.dat", FileMode.Create, FileAccess.ReadWrite))
{
var br = new BinaryWriter(fs);
br.Write(bob); // writes out 24 c4 09 00
fs.Flush();
fs.Close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment