This tag indicates data that is not in full temporarily stored in memory, but processed directly after reception. It is used with processing program input character by character as against line by line or in chunks of a certain buffer size, as well as with fetching results of a database query one by one as against the whole result set at once (e. g. MySQL/PHP use vs. store result).
Questions tagged [unbuffered]
49 questions
94
votes
14 answers
How to avoid pressing Enter with getchar() for reading a single character only?
In the next code:
#include
int main(void) {
int c;
while ((c=getchar())!= EOF)
putchar(c);
return 0;
}
I have to press Enter to print all the letters I entered with getchar, but I don't want to do this, what I want…

javier
- 1,705
- 2
- 18
- 24
19
votes
3 answers
Node.js spawning a child process interactively with separate stdout and stderr streams
Consider the following C program (test.c):
#include
int main() {
printf("string out 1\n");
fprintf(stderr, "string err 1\n");
getchar();
printf("string out 2\n");
fprintf(stderr, "string err 2\n");
fclose(stdout);
}
Which…

gratz
- 1,506
- 3
- 16
- 34
15
votes
5 answers
How can I read process output that has not been flushed?
Consider this little programm be compiled as application.exe
#include
int main()
{
char str[100];
printf ("Hello, please type something\n");
scanf("%[^\n]s", &str);
printf("you typed: %s\n", str);
return 0;
}
Now I…

ArcticLord
- 3,999
- 3
- 27
- 47
15
votes
4 answers
read() of big 6GB file fails on x86_64
Here is the description of my problem:
I want to read a big file, about 6.3GB, all to memory using the read system call in C, but an error occurs.
Here is the code:
#include
#include
#include
#include…

zhanglistar
- 447
- 4
- 15
14
votes
3 answers
unbuffered read from stdin in python
I'm writing a python script that can read input through a pipe from another command like so
batch_job | myparser
My script myparser processes the output of batch_job and write to its own stdout. My problem is that I want to see the output…

Glemi
- 676
- 1
- 7
- 17
12
votes
2 answers
setvbuf not able to make stdin unbuffered
My main intention was to make getchar return as soon as it gets a character instead of waiting for the ENTER key. I tried this
int main()
{
setvbuf(stdin,NULL,_IONBF,0);
getchar();
return 0;
}
Comparing this with the prototype of…

Pavan Manjunath
- 27,404
- 12
- 99
- 125
9
votes
1 answer
Unbuffered Multi-line Comments in CoffeeScript?
Correct me if I'm wrong, the only way to have unbuffered (doesn't output to .js) comments in CoffeeScript is
# This is the only way to mute this single-line comments
The ### buffers comments for multi-line
### This will be outputted to the .js
…

Quang Van
- 11,475
- 12
- 57
- 61
8
votes
3 answers
Unbuffered I/O in ANSI C
For the sake of education, and programming practice, I'd like to write a simple library that can handle raw keyboard input, and output to the terminal in 'real time'.
I'd like to stick with ansi C as much as possible, I just have no idea where to…

Ryan Rohrer
- 599
- 1
- 8
- 16
6
votes
5 answers
Do unbuffered queries for one request
I'm looking to do unbuffered queries only on some requests.
In MySQL I was doing this:
$req = mysql_unbuffered_query('SELECT * FROM forum_topics
ORDER BY (topic_id/topic_stick) DESC, topic_last_post DESC');
while($data = mysql_fetch_assoc($req)) {
…

Saberdream
- 187
- 1
- 9
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
4
votes
1 answer
Python is not working in unbuffered mode
I'm stuggeling with an issue with python. I used Python 2.7.13 and Python 3.6.0 on Red Hat Enterprise Linux Server release 7.1 (Maipo). In order to monitor the proccesses output, I want to use tail -f to take a live look into the STDOUT and STDERR.…

fwillo
- 77
- 1
- 8
3
votes
3 answers
Unbuffered IO in perl
I have a Perl application which writes logs to a file using open and print calls.
open (FH, "d:\\temp.txt");
print FH "Some log";
close (FH);
However during an abrupt shutdown of the machine, the logs are not persisted to the file. So after…

Santhosh
- 6,547
- 15
- 56
- 63
3
votes
1 answer
Read url content, unbuffered php
This function reads an url
function get_url_contents($url){
$crl = curl_init();
$timeout = 5;
curl_setopt ($crl, CURLOPT_URL,$url);
curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT,…

Jeremy Gwa
- 2,333
- 7
- 25
- 31
3
votes
1 answer
Linux, serial port, non-buffering mode
I am trying to organize nob-blocking read-write functionality with serial port in Linux. Here is the code I have: http://pastebin.com/RSPw7HAi
It all works fine, but it is buffered. That means, that if I do input to serial via console + CR symbol,…

Xentatt
- 1,264
- 22
- 35
2
votes
0 answers
Implementing a FUSE Filesystem: iostream, FILE* or plain file descriptors?
I implemented a small read-only FUSE filesystem in C++ that reads the data from a certain multi-file archive. I used iostreams (actually boost::filesystem::ifstream) in order to read the files. Now I wonder if that was a wise decision.
First the…

panzi
- 7,517
- 5
- 42
- 54