Questions tagged [io-buffering]
29 questions
1
vote
1 answer
Grep from stream until finding match
I have a command that outputs a stream say adb logcat. I want to pipe that to grep until I find the first match of a certain query. At this point I want to stop the first command:
I've tried:
MY_VARIABLE=$(adb logcat | grep -m 1 'my variable…

Gabriel Furstenheim
- 2,969
- 30
- 27
1
vote
1 answer
reasons why pipe buffering not working correctly
I countered something that really irritate me while running this code on https://cpp.sh/
// taken from here https://cplusplus.com/reference/cstdlib/atoi/
#include /* printf, fgets */
#include /* atoi */
int main ()
{
…

nadav levin
- 81
- 8
1
vote
0 answers
How to make the _IOLBF option in setvbuf to work
There are many examples on the web on how to use fully buffered/unbuffered streams using the setvbuf utility. However, I am struggling with the line-buffered option.
Suppose, we have a textfile "nums.txt" containing two lines of int numbers.
>$ cat…

Alexander K.
- 21
- 5
1
vote
1 answer
Does calling CloseHandle on a file handle open for writing imply FlushFileBuffers too?
I encountered code similar to this (stripped down for MCVE):
HANDLE hFile = CreateFileW(argv[1], GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
// Note: FILE_FLAG_NO_BUFFERING and FILE_FLAG_WRITE_THROUGH are not…

Govind Parmar
- 20,656
- 7
- 53
- 85
1
vote
1 answer
Cygwin terminal buffers STDOUT
I use Altera Quartus software which comes with its own Cygwin distribution and a dumb terminal which, according to the shortcut placed in my Start Menu by Altera, is run using
cmd.exe /c "c:\altera\15.1\nios2eds\NiosII Command Shell.bat"
where…

Paul Grinberg
- 1,184
- 14
- 37
1
vote
1 answer
Using user-buffered I/O for File operations
I am a newbie to system programming please mind me if my doubt is very vague.
I read that inbuilt user-space buffers are used so that we can access block sized data through a system call via the kernel which takes a huge over head but in the…

jack wilson
- 145
- 1
- 13
0
votes
1 answer
How to monitor the total size of output produced by a subprocess in real time?
The code below is a toy example of the actual situation I am dealing with1. (Warning: this code will loop forever.)
import subprocess
import uuid
class CountingWriter:
def __init__(self, filepath):
self.file = open(filepath, mode='wb')
…

kjo
- 33,683
- 52
- 148
- 265
0
votes
1 answer
In TCL, is it possible to delete top few or n lines of file, when file is under continuous write operation
Below is the piece of code for how the data is being written into file.
set fid [open "file.txt" w]
fconfigure $fid -buffering line
I would like to know if there is any way to delete top n lines of the file without closing fileID i.e., fid, while…

Wasd
- 31
- 2
0
votes
1 answer
lisp read command works wrong for sbcl
I schlocked this example of a read function from (Land of Lisp)in to my sbcl repl and it does not show the prompt: "Please type your name" until after I type in a response. then it shows the response. I know this is wrong what gives?
(defun…

Gregg Arthur Evans
- 109
- 5
0
votes
1 answer
bash, chaining grep commands, processing as the data come
When I use a single grep command, it processes and output the data live as it comes.
Here is my simple test file test.sh:
echo a
sleep 1
echo b
sleep 1
echo ab
sleep 1
echo ba
sleep 1
echo baba
I do the following:
sh test.sh | grep…

MikaelW
- 1,145
- 4
- 11
- 29
0
votes
2 answers
SQL server - high buffer IO and network IO
I have a a performance tuning question on SQL server.
I have a program that needs to run every month and it takes more than 24hrs to finish. I need to tune this program in the hope that I can decrease the running time to 12 hrs or less.
As this…

Tisa
- 11
- 2
- 4
0
votes
1 answer
How to store data on a "dynamic buffer" in Qt?
I tried QBuffer but it seems that it's not useful for me. I need something like the Buffer class in Java
Namely, I want to inject data in buffer and when I read n-size of data (from the end), this should be removed or the seek pointer should be…

anat0lius
- 2,145
- 6
- 33
- 60
0
votes
2 answers
Buffering with Scanner upon System.in in Java
I have a problem with Scanner in Java. I have a method parsing System.in and creating an object bases on this data. But if I create Scanner inside the method, I have 2 ways to do that, i.e. with closing and without. In the first case,…

Evegeny
- 11
- 1
-1
votes
1 answer
Java with NetBeans 7.2.1 - Execution order issue
Consider the following two classes in a NetBeans Java application. The main class:
public class ExcecutionOrder {
public static void main(String[] args) {
Worker worker = new Worker();
worker.init();
…

Christoph Leeb
- 19
- 3