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
17
votes
3 answers

Is there a guarantee of stdout auto-flush before exit? How does it work?

Here is the code (valid C and C++) #include int main() { printf("asfd"); // LINE 1 return 0; } If in line 1 I put segfaulting expression the program would just crash without printing anything (as expected). But why is the…
sasha.sochka
  • 14,395
  • 10
  • 44
  • 68
16
votes
2 answers

Reading output from child process using python

The Context I am using the subprocess module to start a process from python. I want to be able to access the output (stdout, stderr) as soon as it is written/buffered. The solution must support Windows 7. I require a solution for Unix systems too…
Yani
  • 1,465
  • 2
  • 16
  • 25
15
votes
2 answers

Does new line character also flush the buffer?

I understand that questions like, difference between endl and \n have been answered many times on SO. But they only mention that endl is able to flush the buffer onto the stdout, while \n, does not. So, what I understand by buffer being flushed is…
CaptainDaVinci
  • 975
  • 7
  • 23
15
votes
4 answers

c++ std::ofstream flush() but not close()

I'm on MacOSX. In the logger part of my application, I'm dumping data to a file. suppose I have a globally declared std::ofstream outFile("log"); and in my logging code I have: outFile << "......." ; outFile.flush(); Now, suppose my code crashes…
anon
  • 41,035
  • 53
  • 197
  • 293
15
votes
8 answers

Empty or "flush" a file descriptor without read()?

(Note: This is not a question of how to flush a write(). This is the other end of it, so to speak.) Is it possible to empty a file descriptor that has data to be read in it without having to read() it? You might not be interested in the data, and…
Teddy
  • 6,013
  • 3
  • 26
  • 38
14
votes
3 answers

Immediately flushing log statements using the Cocoa Lumberjack logging framework, the way NSLog flushes to console

Many iOS developers have found the Cocoa Lumberjack Logging framework to fill a need that simple NSLog statements don't. It's reminiscent of Log4J in the Java world. In any event, I have written my own custom formatter for Lumberjack, but what I…
idStar
  • 10,674
  • 9
  • 54
  • 57
14
votes
1 answer

Flush disk write cache from Windows CLI

Does anyone know how to flush the disk write cache data from the cache manager for the current directory (or any given file or directory, for that matter), from a Windows command line?
Brian
  • 3,457
  • 4
  • 31
  • 41
13
votes
3 answers

PHP Error: ob_flush() [ref.outcontrol]: failed to flush buffer. No buffer to flush

Could someone please save these 2 files and run them and tell me why I get the error " ob_flush() [ref.outcontrol]: failed to flush buffer. No buffer to flush". I tried googling around and it says that I have to use ob_start(); but when I do then it…
user1191027
13
votes
8 answers

Flushing changes made to VBProject.VBComponents in Excel using VBA

I've been experiencing some strange quirks in Excel while programatically removing modules then reimporting them from files. Basically, I have a module named VersionControl that is supposed to export my files to a predefined folder, and reimport…
CamilB
  • 1,377
  • 1
  • 12
  • 27
13
votes
5 answers

Using flush() method on each 100 rows of 10 000 slows transaction

I have sample project using spring-boot with spring-data-jpa and postgres db with one table. I'm trying to INSERT 10 000 records in the loop into the table and measure execution time - enabling or disabling flush() method from EntityManager class…
user8280225
13
votes
3 answers

Flush output in for loop in Jupyter notebook

I want to print out i in my iteration on Jupyter notebook and flush it out. After the next iteration, I'll print the next i. I tried solutions from this question and this question, however, it just print out 0123...9 without flushing the output for…
titipata
  • 5,321
  • 3
  • 35
  • 59
13
votes
4 answers

How do you flush Python sockets?

I've written a server in Python that is meant to send data to the client in the form "Header:Message" I would like to be able to have each message sent individually so that the client will need to perform minimal work in order to read the "header"…
Jah
  • 131
  • 1
  • 1
  • 3
12
votes
3 answers

python print function in real time

I recently switched OS and am using a newer Python (2.7). On my old system, I used to be able to print instantaneously. For instance, suppose I had a computationally intense for loop: for i in range(10): huge calculation print i then as the…
Rishi
  • 3,538
  • 5
  • 29
  • 40
12
votes
5 answers

PHP Flush() not working in Chrome

I stumbled upon this function which promised to work across IE, FF & Chrome. But it does not work in Chrome. Is there a work around? function buffer_flush(){ echo str_pad('', 512); echo ''; if(ob_get_length()){ …
Kavin Anbazhagan
  • 208
  • 1
  • 2
  • 15
12
votes
3 answers

Does std::endl << std::flush have a purpose?

std::flush right after a std::endl is used all over the legacy code I am looking at. When I first saw this, my thought was it is redundant from looking at the description of std::endl and std::flush…
9Breaker
  • 724
  • 6
  • 16