C
chris chan
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();
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();