Skip to content

Instantly share code, notes, and snippets.

@AzureKitsune
Created June 26, 2012 00:20
Show Gist options
  • Save AzureKitsune/2992278 to your computer and use it in GitHub Desktop.
Save AzureKitsune/2992278 to your computer and use it in GitHub Desktop.
public struct MyStruct
{
int ID {get;set;} //2 bytes?
int Header {get;set;} //5 bytes?
}
public MyStruct ReadFile(string file)
{
MyStruct m = new MyStruct();
using (var fs = new System.IO.FileStream(file, FileMode.Open))
{
Byte[] bID = new Byte[2];
m.ID = fs.Read(bID,fs.Position,bID.Length) > 0 ? bID : 0;
//etc
}
return m;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment