예제 #1
0
        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();
            }
        }
예제 #2
0
 internal static extern bool WriteFile(FileHandle hFile, Byte[] aBuffer, UInt32 cbToWrite, ref UInt32 cbThatWereWritten, IntPtr pOverlapped);