G
Guest
I'm writing to a file using StreamWriter.
I need to know after every file writing, the file size.
I do Flush after each line.
The FileInfo.Length should retune the file size, but it does not.
Here is what I'm doing:
StreamWriter myFile = File.AppendText(fileName);
myFile .Flush();
FileInfo fileInfo = new FileInfo(fileName);
.. . .
myFile.WriteLine("wrting some sext tp the file.");
myFile .Flush();
long size = m_FileInfo.Length;
But I get the same size every time !!!
my questions:
(1) Why I'm getting the same file size every time?
(2) If the write function failed to write the string or part of it, will it
tell be about it by exception or what?
I need to know after every file writing, the file size.
I do Flush after each line.
The FileInfo.Length should retune the file size, but it does not.
Here is what I'm doing:
StreamWriter myFile = File.AppendText(fileName);
myFile .Flush();
FileInfo fileInfo = new FileInfo(fileName);
.. . .
myFile.WriteLine("wrting some sext tp the file.");
myFile .Flush();
long size = m_FileInfo.Length;
But I get the same size every time !!!
my questions:
(1) Why I'm getting the same file size every time?
(2) If the write function failed to write the string or part of it, will it
tell be about it by exception or what?