public FileWriter(string fileName) { var handle = UnmanagedMethods.CreateFile( fileName, DesiredAccess.Write, ShareMode.None, IntPtr.Zero, CreationDisposition.CreateAlways, FlagsAndAttributes.Normal, IntPtr.Zero); _fileHandle = new FileHandle(handle); if (_fileHandle.IsInvalid) { ThrowLastWin32Err(); } }
internal static extern bool WriteFile(FileHandle hFile, Byte[] aBuffer, UInt32 cbToWrite, ref UInt32 cbThatWereWritten, IntPtr pOverlapped);