Friday, March 5, 2010

Append access (FileMode.Append) can be requested only in write-only mode

FileInfo fileInfo = new FileInfo(@"c:\test.txt");
FileStream fileStream = fileInfo.Open(FileMode.Append, FileAccess.Write, FileShare.ReadWrite);
byte[] arr = { 0, 65, 66, 67 };
fileStream.Write(arr, 0, arr.Length);
fileStream.Close();

Append access (FileMode.Append) can be requested only in write-only mode:
FileStream fs = fileInfo.Open(FileMode.Append, FileAccess.Write);

No comments:

Post a Comment