Example #1
0
 public void Write(SafeFileHandle handle, byte *buffer, uint count, ref int written)
 {
     if (!WinNative.WriteFile(handle, buffer, count, ref written, IntPtr.Zero))
     {
         throw new Win32Exception();
     }
 }
Example #2
0
        public static void Write(SafeFileHandle handle, byte *buffer, uint count, ref int written)
        {
#if !__MonoCS__ && !USE_UNIX_IO
            if (!WinNative.WriteFile(handle, buffer, count, ref written, IntPtr.Zero))
            {
                throw new Win32Exception();
            }
#else
            int ret = 0;
            do
            {
                ret = (int)Syscall.write(handle.DangerousGetHandle().ToInt32(), buffer, count);
            } while (Mono.Unix.UnixMarshal.ShouldRetrySyscall((int)ret));
            if (ret == -1)
            {
                Mono.Unix.UnixMarshal.ThrowExceptionForLastErrorIf((int)ret);
            }
            written = (int)count;
#endif
        }