Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [StructLayout(LayoutKind.Sequential, Size = 16, Pack = 1)]
- public struct ListEntry {
- public byte version;
- public UInt16 magic;
- public UInt32 start_time;
- public UInt16 run_id;
- public UInt16 channels;
- public UInt16 sampling_rate;
- public UInt32 start_sector;
- }
- public unsafe Form1() {
- InitializeComponent();
- byte[] test = new byte[] { 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- fixed (byte* p = &test[0]) {
- //ListEntry list = (ListEntry)RawDataToObject(ref test, typeof(ListEntry));
- ListEntry list = (ListEntry)Marshal.PtrToStructure((IntPtr)p, typeof(ListEntry));
- listBox1.Items.Add(list.version);
- list.version = 3;
- listBox1.Items.Add("--");
- for (int i=0;i<16; i++) listBox1.Items.Add(test[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement