Questions tagged [buffered]
96 questions
26
votes
1 answer
Is stdout line buffered, unbuffered or indeterminate by default?
Section 7.19.3/7 of c99 states that:
At program start-up, three text streams are predefined and need not be opened explicitly - standard input (for reading conventional input), standard output (for writing conventional output), and standard error…

paxdiablo
- 854,327
- 234
- 1,573
- 1,953
26
votes
7 answers
Understanding the Java stack
There is this code:
public class Main {
public static void main(final String[] args) throws Exception {
System.out.print("1");
doAnything();
System.out.println("2");
}
private static void doAnything() {
…

sarkiroka
- 1,485
- 20
- 28
24
votes
3 answers
Using io.BufferedReader on a stream obtained with open()?
I want to use a buffered stream because I want to use a peek() method to peek ahead but use my stream with another method that expects a file-like object. (I'd use seek() but may have to handle piped-in I/O that doesn't support random access.)
But…

Jason S
- 184,598
- 164
- 608
- 970
19
votes
1 answer
Explanation for tiny reads (overlapped, buffered) outperforming large contiguous reads?
(apologies for the somewhat lengthy intro)
During development of an application which prefaults an entire large file (>400MB) into the buffer cache for speeding up the actual run later, I tested whether reading 4MB at a time still had any noticeable…

Damon
- 67,688
- 20
- 135
- 185
12
votes
5 answers
Buffered vs non buffered, which one to use?
I am sorry if this is a duplicate but I was not able to find a definitive answer to what is the best practice for each type.
I would like to know what the appropriate conditions are that define when to use BufferedReader vs FileReader or…

stackMe
- 123
- 1
- 6
6
votes
3 answers
For loop with buffered channel
I'm experimenting with Go channels and have an issue where the simple program below does not terminate.
Essentially I want to make some async HTTP get requests and then wait till they are all finished. I'm using a buffered channel but I'm not sure…

Ayub Malik
- 2,488
- 6
- 27
- 42
6
votes
3 answers
Efficient way of handling file pointers in Java? (Using BufferedReader with file pointer)
I have a log file which gets updated every second. I need to read the log file periodically, and once I do a read, I need to store the file pointer position at the end of the last line I read and in the next periodic read I should start from that…

Sudheer
- 329
- 1
- 7
- 21
6
votes
5 answers
Buffered and unbuffered stream
In case of buffered stream it said in a book that it wait until the buffer is full to write back to the monitor. For example:
cout << "hi";
What do they mean by "the buffer is full".
cerr << "hi";
It is said in my book that everything sent to…

AlexDan
- 3,203
- 7
- 30
- 46
5
votes
1 answer
Write to buffered graphics surface via pointer manupilation
I need to render a 1027 * 768 bitmap to the client window (same size) and I don't have more than 10-15 ms to complete this task. I am using bufferedGraphics allocated from a bufferedGraphicsContect object and still notice huge performance issues.
I…

OverMars
- 1,077
- 3
- 16
- 33
5
votes
1 answer
Create a slice of buffered channel in golang
I couldn't find a way to create a slice of buffered channels in golang. I know how to create slice of unbuffered channel given as below
type ch chan int
channels := make([]ch,5)

GoT
- 530
- 1
- 13
- 35
5
votes
3 answers
Buffered Reader readLine() with Empty lines
I am using buffered reader to grab a line at a time from a text file. I am trying to also get the line number from the text file using a tracking integer. Unfortunately BufferedReader is skipping empty lines (ones with just /n or the carriage…

Walt
- 95
- 1
- 1
- 3
5
votes
1 answer
Piping in Windows cmd.exe doesn't forward standard output until the process completes?
Considering pipes in Windows command shell cmd.exe:
C:\>feed | filter
The standard output from the feeding process doesn't seem to reach the standard input of the filtering process until AFTER the feeding process runs to completion.
This type of…

Brian
- 73
- 1
- 5
5
votes
3 answers
C++ buffered stream IO
I understand that by default all stream IO supported by C++ is buffered.
This means that data to be output is put into a buffer till it is full and then sent to the output device, similarly for input, the data is read once the buffer is empty...all…

Arun
- 3,138
- 4
- 30
- 41
4
votes
1 answer
UNIX buffered vs unbuffered I/O
What is the difference between Unbuffered I/O and standard I/O? I know that using read(), write(), close() are unbuffered IO. Printf and gets are buffered IO. I also know that it is better to use buffered IO for big transactions. I just dont know…

Keeto
- 4,074
- 9
- 35
- 58
4
votes
5 answers
How can I buffer non-blocking IO?
When I need buffered IO on blocking file descriptor I use stdio. But if I turn file descriptor into non-blocking mode according to manual stdio buffering is unusable. After some research I see that BIO can be usable for buffering non-blocking…

vitaly.v.ch
- 2,485
- 4
- 26
- 36