Groups | Blog | Home
all groups > c# > august 2003 >

c# : C# has poor performance on large file ?


Jon Skeet
8/6/2003 5:15:04 PM
[quoted text, click to view]

That sounds rather long. Could you write a short but complete program
which demonstrates the problem, and post it? I'll have a look then.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet/
chris chan
8/6/2003 11:41:33 PM
I just want to create a large file with size of 80MB
and add a char 1 at the end.
Two method I has been used.
i) seek to the End and write one char
ii) open the file , and append it to the end

both method take nearly 30sec to do so
I want to ask whether they is other method can do this job
using a shorter time ?

Thx
Chris


FileStream fs = new FileStream(filename, FileMode.Open);
fs.SetLength(size);
fs.Close();

fs = new FileStream(filename,
FileMode.Append,FileAccess.Write,FileShare.None,16384 );
byte c =1;
fs.WriteByte(c);
fs.Close();



AddThis Social Bookmark Button