Questions tagged [stdio]
The stdio tag has no usage guidance.
18
questions
0
votes
1
answer
139
views
How to pipe STDIO from a thread process to /dev/null?
I am trying to run Plarium Play with wine, but have encountered an odd issue. When trying to launch it from a regular desktop entry, I get this JavaScript error:
This does not happen if I launch from ...
-1
votes
1
answer
72
views
Can I use KVM without ioctl?
Recently I've discovered how /dev/kvm doesn't seem to implement functionality for read() or write(), and any attempt to invoke them always results in Error 22 (Invalid argument).
I'm trying to avoid ...
1
vote
1
answer
137
views
Which commands need prefixing by "stdbuf"?
When I have a long running Bash pipeline of commands, and I often can't see any signs of life due to I/O buffering. I found online that buffering can be disabled using stdbuf. An example shown here ...
0
votes
1
answer
107
views
Unexpected behavior of linux specific getline() function in C
#include <stdio.h>
#include <stdlib.h>
#define MAXLEN 1024
void reverse(FILE *, FILE *);
int main(int argc, char ** argv)
{
...
reverse(fptr, stdout);
...
return 0;
}
void ...
0
votes
1
answer
136
views
How `stdio` recognizes whether the output is redirected to the terminal or a disk file? [duplicate]
#include <stdio.h>
#include <unistd.h>
int main(void)
{
printf("If I had more time, \n");
write(STDOUT_FILENO, "I would have written you a shorter letter.\n", 43);
...
0
votes
0
answers
59
views
How to access kallsyms from outside operational system (edk2 SMM driver)?
I'm using EDK2 to write a System Management Mode (SMM) driver. I think it uses "Pure C", given the fact that I'm not able to use standard C library like stdio. Even if I #include <stdio.h&...
0
votes
0
answers
14
views
How to escape standard input when "cat f - g" [duplicate]
man cat shows the following example:
cat f - g
Output f's contents, then standard input, then g's
contents.
How do you escape the standard input and proceed to output the 2nd ...
0
votes
1
answer
268
views
*nix shell: How to disable pipe buffering for ALL pipes in a command?
I want every pipe to be unbuffered, so I don't have to type stdbuf -oL for every piped command. When concocting commands with multiple pipes, it would be nice if there was a environment variable or ...
0
votes
2
answers
197
views
Unexpected expect/ssh question
I am seeking to automate ssh password based logins (and a series of actions after logging in).
I am aware that the ssh password prompt bypasses STDIN. To that end I put together a quick expect script.
...
3
votes
1
answer
555
views
Additional file descriptor for debugging and piped output (logging, metrics, etc)
For a bash script project, I write human-readable log info to stdout/stderr. Additionally, I want to write formatted metrics to a third stream that will be discarded by default but can be redirected ...
1
vote
1
answer
162
views
Did fwrite/fread(3) offer different "multiple items" behavior on different platforms historically?
The fread(3) and fwrite(3) have an extra parameter for a variable number of items. So a typical write often has a hardcoded count when all it has is a char buffer to begin with e.g. fwrite(data, len, ...
1
vote
2
answers
205
views
How to read server stdout and continue only after message is outputted
Say I have a simple Node.js server like:
const http = require('http');
const server = http.createServer((req,res) => res.end('foobar'))
server.listen(3000, () => {
console.log(JSON....
1
vote
2
answers
869
views
Appending both stdout and stderr to file
I have this:
nohup_ntrs(){
nohup_file="$HOME/teros/nohup/stdio.log"
mkdir -p "$(dirname "$nohup_file")";
echo " ------------- BEGIN $(date) -------------- " >> "$nohup_file"
nohup "$@" &...
0
votes
0
answers
36
views
How to determine if a process is part of a pipeline (producer in pipeline)? [duplicate]
So if I am in my terminal and run:
$ my_proc | grep foo
in my_prof I know it's part of a pipeline because stdout is not attached to the terminal but to grep. On the other hand, if I just run this:
$...
1
vote
1
answer
80
views
Writing and Executing Program to behave like console
I have written a set of programs with the intent of using a radio transmitter-receiver (NRF24L01) to connect two devices as if they were connected via a serial interface.
Currently, i am able to ...
4
votes
1
answer
78
views
Determine if producer is outpacing consumer in pipeline
If I have:
node foo.js | node bar.js
is there a way to determine if there is a queue in between them that's building up?
in other words if the producer is outpacing the consumer w.r.t. stdio?
7
votes
3
answers
9k
views
Behaviour of the backspace on terminal
This is about the behaviour of the backspace (\b) character.
I have the following C program:
int main() {
printf("Hello\b\b");
sleep(5);
printf("h\n");
return 0;
}
The output on my ...
7
votes
3
answers
6k
views
Communicate backwards in a pipe
I have a simple pipeline:
node foo.js | node bar.js
bar.js will read from stdin to get data from foo.js.
But what I want to do is ensure that bar.js gets one of the last messages from foo.js before ...