K
Kevin R
This doesnt look right, though it appears to be working
BinaryWriter fileWriter;
for(i = 0; i < someNumber; i++)
{
fileWriter = new BinaryWriter(File.OpenWrite(filename));
// Write some stuff in to the file
// change the value of filename
fileWriter.Close();
}
Is it OK to be instantiating a new BinaryWriter object everytime the
loop is executed (possibly more than 16000 times)? or should I be
using some other method to open a different file each time.
Should I be destroying the BinaryWriter object at the bottom of the
loop each time ?
Another thing which is concerning me,
I have two streams reading from the same file
BinaryReader binReader = new BinaryReader(File.OpenRead(fileName));
BinaryReader dataReader = new BinaryReader(File.OpenRead(fileName));
can I use
dataReader.BaseStream.Position = someNumber;
to move dataReader's file position and be reasonably sure it will not
mess up binReader's file position ?
I've been using this quite successfully so far, so I am inclined to
think it may be OK, but as I am a complete newbie at C#, I thought
maybe I should ask some experts.
Kevin R.
BinaryWriter fileWriter;
for(i = 0; i < someNumber; i++)
{
fileWriter = new BinaryWriter(File.OpenWrite(filename));
// Write some stuff in to the file
// change the value of filename
fileWriter.Close();
}
Is it OK to be instantiating a new BinaryWriter object everytime the
loop is executed (possibly more than 16000 times)? or should I be
using some other method to open a different file each time.
Should I be destroying the BinaryWriter object at the bottom of the
loop each time ?
Another thing which is concerning me,
I have two streams reading from the same file
BinaryReader binReader = new BinaryReader(File.OpenRead(fileName));
BinaryReader dataReader = new BinaryReader(File.OpenRead(fileName));
can I use
dataReader.BaseStream.Position = someNumber;
to move dataReader's file position and be reasonably sure it will not
mess up binReader's file position ?
I've been using this quite successfully so far, so I am inclined to
think it may be OK, but as I am a complete newbie at C#, I thought
maybe I should ask some experts.
Kevin R.