473,394 Members | 1,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

flush works , but there is a time issue.

(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"

Aug 6 '08 #1
5 1901
raulavi wrote:
(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.

--
Göran Andersson
_____
http://www.guffa.com
Aug 6 '08 #2
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

"Göran Andersson" wrote:
raulavi wrote:
(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.

--
Göran Andersson
_____
http://www.guffa.com
Aug 7 '08 #3
On Thu, 07 Aug 2008 08:53:01 -0700, raulavi
<ra*****@discussions.microsoft.comwrote:
Thanks Goran...
Sorry, could you explain a lit bit .

so how is this process done?
StreamWriter writer = ...;

writer.Flush();
writer.BaseStream.Flush();

Pete
Aug 7 '08 #4
Thanks Peter and Goran,

I will test it.

"Peter Duniho" wrote:
On Thu, 07 Aug 2008 08:53:01 -0700, raulavi
<ra*****@discussions.microsoft.comwrote:
Thanks Goran...
Sorry, could you explain a lit bit .

so how is this process done?

StreamWriter writer = ...;

writer.Flush();
writer.BaseStream.Flush();

Pete
Aug 7 '08 #5
writer.BaseStream.Flush();

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

thanks againg to all.

"Peter Duniho" wrote:
On Thu, 07 Aug 2008 08:53:01 -0700, raulavi
<ra*****@discussions.microsoft.comwrote:
Thanks Goran...
Sorry, could you explain a lit bit .

so how is this process done?

StreamWriter writer = ...;

writer.Flush();
writer.BaseStream.Flush();

Pete
Aug 7 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Jon Spivey | last post by:
Experimenting with response.flush() but can't seem to get it to work. This code <% response.write "<p>started</p>" response.flush() for i = 1 to 10000000 i = i +1 next response.write...
30
by: Jonathan Neill | last post by:
I'm aware that there is no ANSI (or POSIX, or any standard, to my knowledge) way of flushing stdin or any other application-level input buffer, but if anyone knows a hack or a non-portable way to...
11
by: Junkguy | last post by:
I need some help programmatically causing a row in a DataGrid to "flush" its contents to its bound data (in Visual Studio 6 using Windows Forms with C#). My issue is I want to send an update to...
0
by: Matthias Straka | last post by:
Hi! I'm working on a website with an IHttpHandler that listens to changes ina database and sends some text to the client. The client is always connected to the handler, this way I can use a...
1
by: nitroamos | last post by:
i'm working on improving the IO for the software project i'm working on to do two extra things. first, i'm going to add HDF5 functionality, and second, add the ability to write binary output. the...
12
by: Daniel Kaplan | last post by:
I was curious about something. In the same table cell I can say this: <A HREF="menu.pl" ><IMG SRC="menu.jpg" width="95" height="35" border="0"></A> <A HREF="help.pl" ><IMG SRC="help.jpg"...
2
by: Kiran | last post by:
Hello Everybody! I am writing a networking application in python for a small piece of hardware, in which there could sometimes be timeouts. I am using sockets to communicate to this device. Data...
1
by: asleepatdesk | last post by:
I am still maintaining/developing a classic ASP application. I have recently built into the app architecture AJAX functionality which works pretty well. The issue: a client wants a report built...
2
by: Damir | last post by:
Hello! I have noticed that after (sucessfully) executing the command: FLUSH PACKAGE CACHE DYNAMIC the dynamic SQL statement cache is not completely cleared (some of the dynamic SQL statement...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.