Questions tagged [flush]

Flush means clearing all the buffers for a stream. This will cause any buffered data to be written to the underlying device.

Flush means clearing all the buffers for a stream. This will cause any buffered data to be written to the underlying device.

1132 questions
46
votes
3 answers

Not buffered http.ResponseWritter in Golang

I'm writing a simple web app in Go and I want my responses to be streamed to the client (i.e. not buffered and sent in blocks once the request is fully processed) : func handle(res http.ResponseWriter, req *http.Request) { fmt.Fprintf(res,…
rmonjo
  • 2,675
  • 5
  • 30
  • 37
45
votes
5 answers

does close() imply flush() in Python?

In Python, and in general - does a close() operation on a file object imply a flush() operation?
Adam Matan
  • 128,757
  • 147
  • 397
  • 562
40
votes
7 answers

How can I flush the output of disp in Matlab or Octave?

I have a program in Octave that has a loop - running a function with various parameters, not something that I can turn into matrices. At the beginning of each iteration I print the current parameters using disp. The first times I ran it I had a…
Nathan Fellman
  • 122,701
  • 101
  • 260
  • 319
38
votes
5 answers

Can you force flush output in Perl?

I have the following two lines in Perl: print "Warning: this will overwrite existing files. Continue? [y/N]: \n"; my $input = ; The problem is that the print line does not get executed before the Perl script pauses for input. That is, the…
John
  • 3,400
  • 3
  • 31
  • 47
36
votes
5 answers

endl and flushing the buffer

In the C++ primer book, in chapter (1), it mentions the following: endl is a special value, called a manipulator, that when written to an output stream has the effect of writing a newline to the output and flushing the buffer associated with…
Simplicity
  • 47,404
  • 98
  • 256
  • 385
32
votes
9 answers

flush in java.io.FileWriter

I have a question in my mind that, while writing into the file, before closing is done, should we include flush()??. If so what it will do exactly? dont streams auto flush?? EDIT: So flush what it actually do?
i2ijeya
  • 15,952
  • 18
  • 63
  • 72
31
votes
9 answers

PHP Flush that works... even in Nginx

Is it possible to echo each time the loop is executed? For example: foreach(range(1,9) as $n){ echo $n."\n"; sleep(1); } Instead of printing everything when the loop is finished, I'd like to see it printing each result per time.
Roger
  • 8,286
  • 17
  • 59
  • 77
29
votes
1 answer

Understanding Streams and their lifetime (Flush, Dispose, Close)

Note: I've read the following two questions already: Can you explain the concept of streams? C# using streams I'm coding in C# In almost all code samples that use streams, .Dispose(), .Flush(), .Close() are almost always called. In the concept…
Omar
  • 39,496
  • 45
  • 145
  • 213
29
votes
2 answers

Do I need to do StreamWriter.flush()?

Suppose this C# code: using (MemoryStream stream = new MemoryStream()) { StreamWriter normalWriter = new StreamWriter(stream); BinaryWriter binaryWriter = new BinaryWriter(stream); foreach(...) { binaryWriter.Write(number); …
Nefzen
  • 7,819
  • 14
  • 36
  • 34
27
votes
7 answers

Close a filestream without Flush()

Can I close a file stream without calling Flush (in C#)? I understood that Close and Dispose calls the Flush method first.
HelpME
  • 271
  • 1
  • 3
  • 4
26
votes
4 answers

How can I output data before I end the response?

Here is my snippet I tested it in Chrome 11, and Firefox 4: var http = require('http'); http.createServer(function(request, response){ // Write Headers response.writeHead(200); // Write Hello World! response.write("Hello World!"); …
Adam Halasz
  • 57,421
  • 66
  • 149
  • 213
26
votes
3 answers

What is meant by 'flushing the stream'?

I've read that '\n' is preferred over 'endl' for new line in c++ because 'endl' inserts new line and flushes the stream. Please tell me what is flushing the stream ?
Anshuman Singh
  • 395
  • 1
  • 4
  • 11
26
votes
5 answers

The consequences and pros/cons of flushing the stream in c++

I have recently read an article which stated that using \n is preferable to using std::endl because endl also flushes the stream. But when I looked for a bit more information on the topic I found a site which stated: If you are in a situation where…
TheJavaFan
  • 341
  • 3
  • 15
25
votes
7 answers

stdout and need to flush it C++

I have some C++ code that uses cout statements for debug purposes and for some reason I can't get all the data to print unless I do a std::cout.flush(); at the end. I don't quite understand why this flush operation is needed. Anyone have any…
Dixon Steel
  • 1,021
  • 4
  • 12
  • 27
24
votes
2 answers

Django flush vs sqlclear & syncdb

Can anyone tell if there is a difference between >manage.py flush # or reset and >manage.py sqlclear appname | python manage.py dbshell >manage.py syncdb
Jibin
  • 3,054
  • 7
  • 36
  • 51
1
2
3
75 76