Tango file i/o
Jason House
jason.james.house at gmail.com
Wed Mar 19 03:50:46 PDT 2008
torhu wrote:
> Jason House wrote:
>> I'm having trouble writing a unit test to check code that communicates
>> via
>> standard in and standard out. Attached to this post is my a reduced form
>> of my problems. Can anyone tell me what's going wrong? (The assert in
>> the code fails)
>
> You need to rewind the file before starting to read after writing:
>
> fakeConsole.seek(0);
I interpret that to mean that writing to the file affects the read stream
and reading affects the write stream. I need to decouple those because
reading and writing should be more or less independent of each other.
It sounds like if I open up a file twice, once for writing and once for
reading, that I can get independent access into the file. The real test is
multi-threaded with reading and writing done asynchronously. With
independent file classes, will EOF be a problem? AKA, if a read occurs
when a write is in progress.
More information about the Digitalmars-d-learn
mailing list