473,748 Members | 2,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1911
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*****@discus sions.microsoft .comwrote:
Thanks Goran...
Sorry, could you explain a lit bit .

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

writer.Flush();
writer.BaseStre am.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*****@discus sions.microsoft .comwrote:
Thanks Goran...
Sorry, could you explain a lit bit .

so how is this process done?

StreamWriter writer = ...;

writer.Flush();
writer.BaseStre am.Flush();

Pete
Aug 7 '08 #5
writer.BaseStre am.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*****@discus sions.microsoft .comwrote:
Thanks Goran...
Sorry, could you explain a lit bit .

so how is this process done?

StreamWriter writer = ...;

writer.Flush();
writer.BaseStre am.Flush();

Pete
Aug 7 '08 #6

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

Similar topics

7
7004
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 "<p>ended</p>" %>
30
45804
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 do this, no matter how obscure or arcane, I'd appreciate it.
11
5945
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 a database from a menu command while the user is editing a DataGrid. This is unusual in regard to examples and normal practice in that the cell of the DataGrid still has the focus. In all examples I can find, the user normally presses a button on...
0
1184
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 push method. Every time a text is to be sent I flush the buffer. The problem is, that there seems to be a minimum size the buffer has to have before asp.net really flushes the buffer and sends the data. As a workaround I insert a few 100...
1
5485
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 software is computational science where a lot of stuff is going to be calculated and written to a file. e.g. could be up to gigabytes of data. my question has to do with the latter -- and how often i need to call "flush" on the stream. what I...
12
2926
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" width="95" height="35" border="0"></A>
2
6781
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 that is sent to the device is instructions for that piece of hardware, and data recieved is just responses from that hardware. When a timeout happens, for some reason extra data is stored inside the buffer, so when the timeout is over, that...
1
3416
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 which could potentilly be huge, up to 5000 rows. My plan is to get the data via an ASP script and response.flush back a delimited string of data (every 100 rows) to be formatted into html by the javascript and displayed in order to avoid the...
2
8959
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 elements are not reset). For example, looking at the dynamic SQL snapshot I see a certain SQL statement that has been executed a number of times and has read a (big) number of rows. Then I execute the "FLUSH PACKAGE CACHE DYNAMIC" command.
0
8832
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9561
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9381
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9254
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3316
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.