D
Daniel Goldman
Hi,
Any advice about both a BinaryReader and BinaryWriter
containing same FileStream at same time? Like:
Stream fs = new FileStream("output.dbf", FileMode.Create);
BinaryReader br = new BinaryReader(fs);
BinaryWriter bw = new BinaryWriter(fs);
/* BinaryWriter writes, flushes, etc */
/* BinaryReader seeks, reads, etc */
/* BinaryWriter seeks, writes, etc */
Same question for StreamReader and StreamWriter containing
same FileStream at same time.
Also, is it asking for trouble to have combination of text
and binary writers (SW and BW) contain and fiddle with same
FS at the same time? I could change some file formats instead.
FS object doesn't know which objects contain it, doesn't care
how many containing objects call methods on it. As long as I
make sure no other process is accessing the Stream when it is
being written to, there will be no problem. Correct?
Any books/tutorials that discuss multiple objects containing
same stream at same time?
Thanks,
Daniel Goldman
Seattle, WA
Background - I'm porting a C program to C#. It reads and
writes various binary and text formats. I want to make C#
non-interface program flow parallel existing C logic (I'm not
discarding the C program). I've read and experimented a fair
amount with System.IO, but I have not found mention of
multiple objects containing same stream, which would make
it easier to mimic C IO logic. It seems to work, but I'd
like to know more before going further.
Any advice about both a BinaryReader and BinaryWriter
containing same FileStream at same time? Like:
Stream fs = new FileStream("output.dbf", FileMode.Create);
BinaryReader br = new BinaryReader(fs);
BinaryWriter bw = new BinaryWriter(fs);
/* BinaryWriter writes, flushes, etc */
/* BinaryReader seeks, reads, etc */
/* BinaryWriter seeks, writes, etc */
Same question for StreamReader and StreamWriter containing
same FileStream at same time.
Also, is it asking for trouble to have combination of text
and binary writers (SW and BW) contain and fiddle with same
FS at the same time? I could change some file formats instead.
FS object doesn't know which objects contain it, doesn't care
how many containing objects call methods on it. As long as I
make sure no other process is accessing the Stream when it is
being written to, there will be no problem. Correct?
Any books/tutorials that discuss multiple objects containing
same stream at same time?
Thanks,
Daniel Goldman
Seattle, WA
Background - I'm porting a C program to C#. It reads and
writes various binary and text formats. I want to make C#
non-interface program flow parallel existing C logic (I'm not
discarding the C program). I've read and experimented a fair
amount with System.IO, but I have not found mention of
multiple objects containing same stream, which would make
it easier to mimic C IO logic. It seems to work, but I'd
like to know more before going further.