C
Cool Guy
I use the following method to read a file:
static byte[] ReadFile(string path)
{
FileStream stream = new FileStream(path, FileMode.Open);
BinaryReader reader = new BinaryReader(stream);
byte[] result = reader.ReadBytes((int)stream.Length);
reader.Close();
return result;
}
Do I need to lock the file because this method is called from worker
threads? I mean, would reading the same
file more than once at the same time cause problems?
static byte[] ReadFile(string path)
{
FileStream stream = new FileStream(path, FileMode.Open);
BinaryReader reader = new BinaryReader(stream);
byte[] result = reader.ReadBytes((int)stream.Length);
reader.Close();
return result;
}
Do I need to lock the file because this method is called from worker
threads? I mean, would reading the same
file more than once at the same time cause problems?