Skip to main content

Questions tagged [stdin]

Standard input (stdin, file descriptor 0) is the input stream to a program.

0 votes
0 answers
68 views

stdin file descriptor never ready on POLLIN event

I have a C source code that I intend to port from Linux to Windows. After updating the 'poll' function to 'WSAPoll,' I notice that 'revents' on 'stdin' never becomes ready, causing 'WSAPoll' to block ...
Yuki San's user avatar
1 vote
1 answer
104 views

Exit inner loop only when EOF (Ctrl+D) is given via standard input

My program has a main while loop as the main logic, with an inner while loop for running the logic of the "command function". When inside the inner while loop, I want EOF (Ctrl + D) to exit ...
LHY's user avatar
  • 441
1 vote
2 answers
573 views

Difference to get string with gets and fgets in C

My question is, what is the difference between these two pieces of code. 1) #include <stdio.h> #include <stdlib.h> #define SIZE 7 int main() { int strSize; char tim[SIZE]; ...
PLC_Guy's user avatar
  • 11
0 votes
1 answer
35 views

Calling bash from python subprocess maintaining context, returning results and printing to screen

I have a function that sends a statement to bash. It prints the output in real time to the console and also returns the value. It works flawlessly and looks like this: def call_in_bash(statement): ...
Guillemdc's user avatar
0 votes
1 answer
115 views

Input, left arrow key - Rust

I wrote this code for create an user input. std::io::stdout().flush().expect("Failed to flush stdout"); std::io::stdin().read_line(stdin_buffer).expect("Failed to read from stdin");...
Saviam's user avatar
  • 37
2 votes
0 answers
67 views

Read from stdin, but only while socket is connected

I'm trying to build a simple Rust in-terminal TCP chat program. I want to read user input from stdin, but only while the connection is still alive. Specifically I want to avoid the situation where you ...
Valentin Metz's user avatar
0 votes
1 answer
74 views

How to write a BASH command in C which use stdin and stdout

I want to write a programme where I compile a C programme, and save it where BASH recognises programmes are (/usr/bin or somewhere). For usage I want to run in the terminal $ c_programme <...
1toneboy's user avatar
  • 119
0 votes
0 answers
48 views

C# start python process which listens to StandardInput

I'm using Process.start() in python to start a python script. In general this works, but I have a problem concerning the performance when starting the python script. The process is as follows: C# ...
Lennart's user avatar
  • 111
2 votes
1 answer
321 views

How can I read more than 4096 bytes from stdin, copy-pasted to a terminal on Linux?

I have this code: import sys binfile = "data.hex" print("Paste ascii encoded data.") line = sys.stdin.readline() b = bytes.fromhex(line) with open(binfile, "wb") as fp:...
Bart Friederichs's user avatar
1 vote
0 answers
143 views

OSError: pytest: reading from stdin while output is captured

I am facing a problem in my exercism python exercise 2. I have written the program and it is working fine but when i submit it on exercism it says "OSError: pytest: reading from stdin while ...
Mughees Urrehman's user avatar
0 votes
0 answers
85 views

How to execute process with mmap-ed memory as stdin and another mmap-ed memory as stdout?

It is possible in Linux execute process with mmap-ed memory as stdin and another mmap-ed memory as stdout, so parent program can preallocate memory for stdin, write necessary data, execute program and ...
Антон Сазонов's user avatar
1 vote
0 answers
46 views

Child process using boost::process::child reading some characters from STDIN

Main process is spawning a child process as follows: bp = boost::process bp::child(cmd.c_str(), bp::std_out > bp::null, bp::std_err > bp::null, boost::this_process::environment()); where cmd = &...
Harshil's user avatar
  • 33
0 votes
0 answers
14 views

How to input hexcodes/escape sequences through stdin into a program that reads from it twice?

I have a C binary that, prints out an integer (let's call it modifiedInteger) takes input from stdin given modifiedInteger = secretMathFunction(originalInteger), if input is equal to originalInteger, ...
mag.a420's user avatar
0 votes
0 answers
52 views

Get current console output(sys.stdin) in python

I want to get the current console output(sys.stdin) of my program in python. I found the answer for sys.stdout, however, I found out for the output caused by input() function it goes to sys.stdin ...
Kisaac's user avatar
  • 1
0 votes
0 answers
37 views

How to launch a program and have a pipe to both stdin and stdout in C on linux [duplicate]

I'm trying to write a C program to configure lemonbar, a status-bar for linux, and i'd like to have the bar be interactive. The problem is that to write to the bar you have to use the program stdin ...
Eto on a mill's user avatar

15 30 50 per page