Skip to main content

Questions tagged [stdin]

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

stdin
0 votes
0 answers
49 views

How can I get this STDIN to work in GAS Assembler running on Linux?

I am new to Assembler and am currently reading a book about it by Jonathan Bartlett called 'Learn to Program with Assembly'. On pages 160-1 he gives the following sample program to demonstrate the use ...
Digital Samizdat's user avatar
0 votes
0 answers
36 views

asio::stream_descriptor for async read from stdin in raw mode crashes

I want to poll stdin asynchronously for terminal keyboard events, hence the following /* class tui contains a member 'stdin_' of type 'asio::stream_descriptor', initialized as such : stdin_{...
kmft3kte's user avatar
0 votes
0 answers
17 views

Send SSH input when output string is detected on windows from python

My company requires a passcode when SSHing to a server: ssh myserver Enter a passcode or select one of the following options: Passcode: I want call SSH in the background from a GUI so want to detect ...
Geordie's user avatar
  • 2,056
5 votes
7 answers
268 views

gawk hangs when using a regex for RS combined with reading a continuous stream from stdin

I'm streaming data using netcat and piping the output to gawk. Here is an example byte sequence that gawk will receive: =AAAA;=BBBB;;CCCC==DDDD; The data includes nearly any arbitrary characters, but ...
user12280249's user avatar
0 votes
1 answer
21 views

undetectable Dart-Input in Visual Code Studio

I made a script in in Visual Studio Code using Dart that grabs the user's input. The problem is, that if I enter something in the input line in vscode, which is located below the debug console and ...
Bluefy's user avatar
  • 3
0 votes
0 answers
53 views

Break the loop if stdin has value

I can not stop the loop if there is not a gap in data send via UART. If there is gap in data it listens to the command but does not read the UART data anymore. I would like to I read data on UART and ...
petrbon's user avatar
1 vote
1 answer
51 views

How do I read all keys pressed in nim since the last call to a function, without needing to press enter

I need to read keys from stdin without blocking, and without only recieving them when a newline is pressed. The way i would like it be formatted is a sequence, where each item is a keypress or ascii ...
Bobson Tobson's user avatar
0 votes
0 answers
36 views

How do I know when a program is waiting for an input and then give the input through Python?

Sorry, this might look very stupid but I have a console C++ program and I need to pass input through Python. It is unexpected when this C++ program waits for an input and so I hoped I could have done ...
Jugert Mucoimaj's user avatar
-1 votes
1 answer
47 views

Wrapping os.Stdin with an io.TeeReader breaks the tty

Context: I am trying to write a small tool in Golang, which spawns a vim editor and tries to record all the keystrokes input by the user. package main import ( "bufio" "fmt&...
Shubhang b's user avatar
0 votes
0 answers
11 views

Console screen import/export error when using freopen

Can anyone tell me that when using freopen, sometimes when I call new functions using input and output commands on the console screen, it doesn't work? When running, it still works and still processes ...
Thông Lúc's user avatar
0 votes
0 answers
23 views

Removing [stdin] keypress listener (or going around) from 3rd party app within plugin/extension (Vitest in this case)

I am writing Vitest reporter, when running tests in watch mode there is an active listener on keypress event on stdin. I want to have my own handling of user interaction, and this one pretty ...
Jarek's user avatar
  • 7,651
0 votes
0 answers
18 views

Building a menu with inputs from serial port on a Pi Pico

After getting the first input, is not following the normal logic to continue waiting for the input and directly return an error. 1.Checking if there is any data on the stdin with readline() function ...
Plasoianu Alexandru's user avatar
1 vote
1 answer
67 views

How can I read from neovim's stdin, using rust?

I'm pretty new to rust and I thought I could get some help here. I'm trying to follow a guide about making LSPs from TJ DeVries, he is coding it in Go but I'm trying to follow along in Rust. I'm stuck ...
Cristi's user avatar
  • 109
0 votes
1 answer
51 views

Bash - Log timestamp of the moment data was received on stdin, coming from a pipe

I have an application that outputs to stdout from time to time - random intervals, random durations of outputting before going silent again. Its output (binary data) is captured into a file. I want to ...
programings's user avatar
0 votes
0 answers
58 views

Redirect sendNativeMessage sent to batch file

I am trying a test addon on mozilla that uses sendNativeMessage(). This addon sends a "ping" string to a .bat file. I am trying to get the input and redirect it to a file.txt. Sadly, all i ...
user3916429's user avatar
0 votes
0 answers
44 views

getline() in C is not receiving input

I am trying to build a simple shell and im having a huge problem with receiving input from the stdin. For whatever reason when i call getline(), the program gets stuck there and it can't progress. ...
Percy's user avatar
  • 1
-1 votes
1 answer
73 views

C# code, SendKeys.Send gets "Access denied..." error occasionally [duplicate]

I have a C# code, in which I need to run a very old vendor binary to ASCII conversion program, here is relevant part of my code: C# code with SendKeys.Send "Access denied..." These codes are ...
gdu000's user avatar
  • 1
0 votes
1 answer
42 views

How to properly escape/quote the output so it's treated as an escaped input? [duplicate]

I've been trying to create a set of aliases or functions, that I can use in conjunction with file operating commands. The idea is to have 1, 2, 3 functions/aliases that will return latest, second-to-...
Mirek's user avatar
  • 397
0 votes
0 answers
35 views

Read a single char value to stdin without pressing enter on keybard in C in mac os [duplicate]

I am using mac os with xcode-select version 2406 I am trying to find a way to Read a char value to STDIN without pressing enter or return key on keyboard in C. I know on windows we have getch function ...
Pritam's user avatar
  • 7
1 vote
1 answer
62 views

Piping input into running Python script

Maybe this is the wrong approach, so feel free to redirect. I am trying to asynchronously pipe input into a python script. The idea is that I have a background Python script do some long initial setup ...
BrettOC's user avatar
  • 69
3 votes
1 answer
202 views

Reading and Writing more than 4096 bytes to and from STDIN [closed]

I'm trying to implement a here document like the one used in bash (in C), but I noticed that I can't give it a line that's longer than 4096 bytes, I looked it up and It was because of the max size of ...
Anass Abidar's user avatar
0 votes
0 answers
30 views

How to read piped input and use Console.ReadLine() in the same C# program?

I am trying to create a program that must accept piped input, and be able to request more input from the user afterwards. The problem is that after I read the piped input, I can no longer use Console....
Adrian's user avatar
  • 41
2 votes
0 answers
38 views

Writes to child subprocess.Popen.stdin don't work from within process group?

From within a Python script, I'm launching an executable in a subprocess (for anyone interested: it's the terraria server). # script.py server_process = subprocess.Popen("my_executable arg1 arg2&...
pipsqueaker117's user avatar
4 votes
2 answers
381 views

How can I read a single line user input with Bun.js?

Bun.js has a useful native API to read periodical user input: const prompt = "Type something: "; process.stdout.write(prompt); for await (const line of console) { console.log(`You typed: ${...
Mir-Ismaili's user avatar
1 vote
1 answer
96 views

Communicating Java and Python processes freeze after a while when using readline() but not input()

I have a Java program that needs to process a long series of input strings. To do this it goes through each string, passes it to a Process (a Python script), gets the result from the Process's ...
Zyxl's user avatar
  • 115
0 votes
1 answer
49 views

Redirecting stdout with execvp

This code basically a small part of the binary tree with nodes being processes, and it should traverse the tree inorder way passing num1 to left subtree etc. This one just creates a left child and ...
Özgür Çavuşoğlu's user avatar
0 votes
0 answers
64 views

tar extract zip archive from file or STDIN - discrepancy

Training to download and extract archive (zip archive, created by 7z) by curl --output - "https://host.com/archive.zip" | tar -f - -C %dest_dir% but archive extract is incomplete. Some ...
user2956477's user avatar
  • 1,318
0 votes
2 answers
156 views

Why is STDIN open by default for programs running in SystemD?

I have an if-statement at the top of a C main method, which checks if STDIN is open. If it is open, the program prints an error and exits. This is mainly for documentation reasons. I don't want ...
Seán Healy's user avatar
0 votes
0 answers
66 views

Is it possible to listen for console input from a C# Windows Application?

I have a .NET Core 3.0 Windows application that was interfacing with Chrome native-messaging stdin, however after .NET 8 migration, the application no longer has console stdin access. (Note: it was ...
codenamezero's user avatar
  • 2,950
0 votes
1 answer
49 views

Executing sed via execvp makes other pipes blocked

I am playing around with fork/pipe/dup/execvp concepts and came out with a little problem: I made a test main to execute sort and manually send some numbers via pipe bound to STDIN and it works as ...
StormByte's user avatar
  • 1,299
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
0 votes
0 answers
44 views

How to get rid of Go routine "process" after the GO routine times out?

I have an interesting challenge. I have a go routine that should display an error message for 4 seconds or until I press any key. If I press a key within the 4 seconds it works as expected but if I ...
sudeki's user avatar
  • 11
1 vote
2 answers
37 views

How to apply the linux 'file' command to the output (STDOUT) of a program to determine its file type

I want to determine the file-type of the contents of the STDOUT output of a program (without first saving the output to a file) i.e., notionally, I would like to run: myprogram | file However, `/usr/...
puterboy's user avatar
0 votes
2 answers
105 views

How can I read from stdin in a test with Maven?

I'd like to read from stdin as part of a test for my Java project, which uses Maven as its build tool. My Java code is something like this (simplified for demonstration purposes): try (Scanner stdin = ...
C0urante's user avatar
0 votes
2 answers
76 views

Make sh Commands Stream to Capture Stdin

Having script.sh #!/bin/sh sh <<EOF cat | xargs -n 1 echo captured echo first echo second EOF Running this would output captured echo captured first captured echo captured second So that the ...
404's user avatar
  • 379
1 vote
1 answer
162 views

how can i send the backspace key to stdin?

I'm creating a Node.js application in Linux that spawns a child process, bash, when someone connects to the server via WebSocket. It sends all data sent through the WebSocket to stdin and sends all ...
eac's user avatar
  • 111

15 30 50 per page
1
2 3 4 5
79