flush works , but there is a time issue.

R

raulavi

(a little more info)
after flushing the line (instead of closing streamwirter)
it takes some x time to flush the line
so, when I read from the file I cannot find the last written line.

if I close the streamwriter it does find the line always.
but , my next write fails "Cannot write to a closed TextWriter"
 
G

Göran Andersson

raulavi said:
(a little more info)
after flushing the line (instead of closing streamwirter)
it takes some x time to flush the line
so, when I read from the file I cannot find the last written line.

if I close the streamwriter it does find the line always.
but , my next write fails "Cannot write to a closed TextWriter"

Flushing the StreamWriter doesn't flush the underlying FileStream. You
have to flush that after flushing the StreamWriter for the line to end
up in the file.
 
R

raulavi

Thanks Goran...
Sorry, could you explain a lit bit .

so how is this process done?

write a line
?????close, flush or what???

????what do we need here to
read the last line written
 
R

raulavi

writer.BaseStream.Flush();

is the solution... at least for my prototype. Lets see the real thing..

thanks againg to all.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top