示例#1
0
        public static Termios fromBytes(byte[] arr)
        {
            Termios str = new Termios();
            //Debug.WriteLine(Marshal.SizeOf(str));
            int    size = Marshal.SizeOf(str);
            IntPtr ptr  = Marshal.AllocHGlobal(size);

            Marshal.Copy(arr, 0, ptr, size);

            str = (Termios)Marshal.PtrToStructure(ptr, str.GetType());
            Marshal.FreeHGlobal(ptr);

            return(str);
        }