Standard input (stdin, file descriptor 0) is the input stream to a program.
Questions tagged [stdin]
3861 questions
1
vote
1 answer
How to implement blocking iterator over stdin?
I need to implement a long-running program that receives messages via stdin. The protocol defines that messages are in form of length indicator (for simplicity 1 byte integer) and then string of a length represented by length indicator. Messages are…

user3589900
- 33
- 1
- 6
1
vote
1 answer
Problem when reading values from console using stdin.read()
I have this part of python code that should read input values from the screen.
When it runs, it keeps running forever. I tried CTRL+D as per the search results, but it does not work. This code is given and it works when I submit the code to an…

MSaudi
- 4,442
- 2
- 40
- 65
1
vote
2 answers
scanf on non-STDIN input
Is it possible to run scanf on input that it is not STDIN? What I mean is if I have a string="hello 1 2 3", can I run scanf on it to extract the string and three integers?
Is there another function that can do this?

tekknolagi
- 10,663
- 24
- 75
- 119
1
vote
1 answer
Reading lines from input
I'm looking to read from std::in with a syntax as below (it is always int, int, int, char[]/str). What would be the fastest way to parse the data into an int array[3] and either a string or char…

badatpython
- 13
- 4
1
vote
2 answers
Passing input to subprocess popen at runtime based on stdout string
I am trying to run following code
process = subprocess.Popen(args=cmd, shell=True, stdout=subprocess.PIPE)
while process.poll() is None:
stdoutput = process.stdout.readline()
print(stdoutput.decode())
if '(Y/N)' in stdoutput.decode():
…

phileinSophos
- 362
- 4
- 22
1
vote
2 answers
Socket programming : why are the behaviors of recv() and read() not the same?
I use select() to receive data from stdin.
The code is here:
#include
#include
#include
#include
int main()
{
fd_set rfds;
struct timeval tv;
int retval;
char buf[100];
…

atomd
- 558
- 1
- 5
- 11
1
vote
1 answer
How to write a test to confirm that a perl script waits (or doesn't wait) for interactive user input (based on supplied options)
I have a perl script for which I would like to write a few tests. If the perl script gets supplied a specific option, the user is allowed to paste or type out multi-line input and end their input using control-d.
These are the tests I want to…

hepcat72
- 890
- 4
- 22
1
vote
1 answer
JupyterLab | stdin user input via. shell. Entry into output cell field
Google Colab allows you to enter values into an output cell, during runtime.
Can I enter in user input, when calling a program via. the shell?
Can JupyterLab handle stdin from the shell?
Example:
Cell: !tensorboard dev upload --logdir tb_logs --name…
user16341274
1
vote
1 answer
Node js how to get list of keys pressed
I'm writing a command line app using Node js. I'm trying to get keypresses from stdin. Here's what I've tried so far:
const readline =…

Peter Kapteyn
- 354
- 1
- 13
1
vote
1 answer
Clear the existing instance of stdin.read_line in rust
I am trying to read input lines from the console. I am using the async_std crate for reading the lines.
The stdin.readline is called at multiple places.
Is there a way to cancel or flush the previous instance of stdin.read_line, before calling…

Ganesh Rathinavel
- 1,243
- 4
- 17
- 38
1
vote
1 answer
Interfacing Python With Fortran through Command-Line Using Pexpect
I am using pexpect with python to create a program that allows a user to interact with a FORTRAN program through a website. From the FORTRAN program I am receive the error:
open: Permission denied apparent state: unit 4 named subsat.out.55 last…

Mat Kelly
- 2,327
- 7
- 29
- 51
1
vote
0 answers
How to block a python thread as long as there is no data from stdin?
My function is supposed to check if there is stdin input, and if there is, put it into a queue:
def readUserInputThread(keyboard_queue):
kb = KBHit()
while True:
time.sleep(0.01)
if kb.kbhit():
c = kb.getch()
…

Colum31
- 23
- 5
1
vote
1 answer
stdout hangs on blinking cursor
I have a process struct, which holds a process handle:
pub struct Process {
process: Child,
init: bool
}
I have a seperate function where I can 'talk' to the engine.
fn talk_to_engine(&mut self, input: &String) -> String {
let…

MitchellWeg
- 49
- 1
- 7
1
vote
1 answer
How can I pass an image as an argument to a python script from a c# application without writing/reading it from disk?
Hi I have a C# program that opens a process and calls a python script to execute some operations on an image.
Currently, I'm saving the image to the disk and passing the path to my python script as an argument, but I want to speed it up and wonder…

Felipe Cunha
- 166
- 1
- 5
1
vote
1 answer
make stdin unbufferd for long lines in console ... cat > textfile
maybe a peculiar question, but
I came across an odd result when pasting through cat into a text file (cat > textfile and signaling EOF by Ctrl+D when done ) on ubuntu linux.
It turns out the stdin line buffer prevents lines exceeding 4k (see Line…

Summer-Sky
- 463
- 8
- 21