Standard input (stdin, file descriptor 0) is the input stream to a program.
Questions tagged [stdin]
3861 questions
1
vote
0 answers
How can I use stdin while piping data when using promptui?
I am trying to write a simple cli using promptui and everything is working as expected; till I try to pipe data to it. After some debugging and digging around, I realized that this is so because stdin is being used already when piping so that stdin…

securisec
- 3,435
- 6
- 36
- 63
1
vote
2 answers
How do I feed a string to a function's input statement in Python?
In python I have a function which has an input statement, and assume that the function is a blackbox so I cannot edit the function. Instead of letting users to type and input, I want to feed a string to the input statement.
I have found a way to do…

Tong Tony
- 43
- 1
- 7
1
vote
1 answer
What signals to scanf to read?
In the following snippet, after reading the int the '\n' remains in the stdin, and is read by second scanf.
Is scanf called on the enter, and then reads what is in the stdin, or is it called before typing happens?
What signals to scanf that the…

mdjukan
- 41
- 3
1
vote
0 answers
Why does passing a variable from one bash script to another cause it to fail?
I have been trying to figure this one out for a while. I am trying to automate a few things. I only have rights to edit the scripts I write. I am currently using my script to call another script that I cannot edit, let's call it script.sh
I have…

Twitch008
- 29
- 4
1
vote
0 answers
PowerShell string from stdin
I'm busy with writing a script to process log files, that contain multi-line events.
I'm using this line to split up the file to individual events:
$Messages = ((Get-Content $File -Raw) -split '(?m)(?=^\d{4})')
(Basically find 4 digits on the…

Radir
- 11
- 2
1
vote
2 answers
How to redirect input to python script
How come this command python test.py <(cat file1.txt) does not work accordingly. I could've sworn I had this working previously. Basically, I would like to get the output of that cat command as an input to the python script.
This command
cat…

user1179317
- 2,693
- 3
- 34
- 62
1
vote
1 answer
Pipes in C, buffer for reading stdin
I'm trying to understand this this answer. Especially, how does data flow across processes?
I assume that input stream flows through a child's input through output connected with pipe, then is collected by a parent through pipe output. However,…

wannalearn
- 11
- 2
1
vote
1 answer
When there is no output on the left side of the pipe, what happened on the right side of the pipe?
when I put a no output program on the left of pipe, such as:
// program a
int main() {
char s[255];
scanf("%s", s);
return 0;
}
and a program with input & output on the right:
// program b
int main() {
char s[255];
scanf("%s",…

yztz
- 11
- 1
1
vote
1 answer
How to receive simple one-line user input with nodeJS?
I want to run a nodeJS application with my own very simple console, so my question is how can I achieve it in a straightforward way (typical of any programming language).
I've seen articles like How To Read User Input With NodeJS but I am not sure…

sw.
- 3,240
- 2
- 33
- 43
1
vote
0 answers
How can I get user input of type integer in dart?
How can I get user input of type integer in dart? I tried the following, but does not work.
int calculate(){
int x = int.parse(stdin.readLineSync());
int y = int.parse(stdin.readLineSync());
return x + y;
}
I got this error:
Error: The…

Nuh Yamin
- 11
- 4
1
vote
1 answer
Eclipse: EOF not detected when CSV-parsing standard input
Use Eclipse (2021-06, 4.20.0) run-config settings in "Common" tab to attach a csv file to standard input. Attach a CSV parser to standard input.
Pulling CSV records from the parser gets all the file content, but doesn't detect EOF. This happens with…

Underhill
- 408
- 2
- 13
1
vote
1 answer
Objective C : How to keep listening to incoming data on stdin?
I am trying to call a MacOS app written in Objective C from a Browser extension using native messaging.
So far I have come up with this code which handles requests made with chrome.runtime.sendNativeMessage.
int main(int argc, char * argv[]) {
…

Goasmad
- 69
- 9
1
vote
1 answer
stdin.readLineSync() can't handle special characters
I'm a beginner in Dart. I want to write a program that takes an input and print it with some predefined text.
This is how my code looks like:
import 'dart:convert';
import 'dart:io';
main() {
print('What is your name?');
print('Hello…

TLeo
- 76
- 6
1
vote
1 answer
When using the open command, and O_CREAT, it is appending a "?" to the end of the file name, how do I remove this?
So I am using the open function in C to open a target file, and if it does not exist, I will create it. I am redirecting stdout from the terminal into this file. When I run my program, it creates a new file with the name that I type into the shell,…

Jorge
- 69
- 8
1
vote
1 answer
Bash read command with cat and pipe
I have two scripts:
install.sh
#!/usr/bin/env bash
./internal_install.sh
internal_install.sh
#!/usr/bin/env bash
set -x
while true; do
read -p "Hello, what's your name? " name
echo $name
done
When I run ./install.sh, all works as…

Tibor Takács
- 3,535
- 1
- 20
- 23