Hi all,
I'm trying to use the Win32 API to make a sub-thread that reads from STD_INPUT_HANDLE and pushes the bytes it reads into a socket. Because I want to be able to shut down this thread safely when it's time to exit, I'm using ReadFileEx() and overlapped I/O instead of plain old blocking ReadFile(). The idea is that my thread will...
How can you make SSH read the password from stdin, which it doesn't do by default?
...
I have a Perl script which forks and daemonizes itself. It's run by cron, so in order to not leave a zombie around, I shut down STDIN,STDOUT, and STDERR:
open STDIN, '/dev/null' or die "Can't read /dev/null: $!";
open STDOUT, '>>/dev/null' or die "Can't write to /dev/null: $!";
open STDERR, '>>/dev/null' or die "Can't write to /dev/nu...
I am looking for a way to dump input into my terminal from a file, but when EOF is reached I would like input returned back to my keyboard. Is there a way to do this with Bash (or any other commonly-available *nix shell)?
Details:
I am debugging a server program which executes a fork to start a child process. Every time I start a debu...
Hello,
I have now whittled this down to a minimal test case. Thus far I have been able to determine that this is an issue related to pseudo-terminals which come about with the pipe of ssh. Adding the '-t -t' to the ssh call improved things, in that now, it takes a second call to fgets() to cause the issue. I suspect that the stderr o...
I'm trying to do the opposite of
http://stackoverflow.com/questions/1312922/detect-if-stdin-is-a-terminal-or-pipe-in-c-c-qt
I'm running an application that's changing its output format because it detects a pipe on stdout, and I want it to think that it's an interactive terminal so that I get the same output when redirecting.
I was thi...
I'm trying to do some of the code golf challenges but they all require the input to be taken from stdin and I don't know how to get that in python.
...
I'm looking to write a pair of utilities that read in a newline separated list of integers on stdin and output their binary (4 byte) equivalent to stdout, and vice versa.
My first thought was a simple bash/linux command that would do this, but I was unable to find one. My second thought was to do this in C++, but I can't figure out how...
Hi I am using raw.c for keyboard capture. Following code finds when an arrow key/ esc is pressed. At the same time I want to read whole words that user inputs and these should be shown on stdout as well.
char pp = 0;
char p = 0;
while( (i = read(0, &c, 1)) == 1) {
if (pp == 033 && p == 0133 && (c &= 255) == 0102) /* DOWN */ break;
if (c...
What I would like is to have the process start but have the input and output all be in the same console.
if(CreateProcessWithLogonW(user,domain, pass, LOGON_WITH_PROFILE, NULL, cmd, 0, 0, 0, &sa, &pe))
{
printf("[~] Process spawned with PID %X\n", pe.dwProcessId);
}
else
{
printf("[!] Failed to create process. Error Code: %X\n", GetL...
I'm using Eclipse to develop a Java program, and figured I'd add an option to my program to parse stdin if there are no arguments. (otherwise it parses a file)
I am having problems if I execute "somecommand | java -jar myjar.jar" and went to debug... then realized I don't know how to start a process in Eclipse like that. And if I run it...
I'm interested in two situations:
How to do it from C++?
How to do it from system's shell?
Answers for Linux, Windows and OSX are welcome.
...
I need my program written in pure C to stop execution when stdin is closed.
There is indefinite work done in program main cycle, and there is no way I can use blocking checks (like getc()) there (no data is supposed to arrive on stdin - it just stays opened for unknown time).
I intend to use described functionality in realization of ne...
I get a weird error ("The process tried to write to a nonexistent pipe.") if I stop reading from piped input, from a program that works fine for non-piped input. How can I avoid causing this error?
code:
package com.example.test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class...
I have a function (in C) that gets input from the user, (using scanf) stores it in an unsigned int, and returns the input to other functions that handle it:
unsigned
int input(void)
{
unsigned int uin;
scanf("%u", &uin);
return val;
}
I was wondering, being as I ought to flush stdin, I'd want to use a while loop using get...
Hey guys, I'm trying to build an instruction pipeline simulator and I'm having a lot of trouble getting started. What I need to do is read binary from stdin, and then store it in memory somehow while I manipulate the data. I need to read in chunks of exactly 32 bits one after the other.
How do I read in chunks of exactly 32 bits at a ti...
Note:
# cat /tmp/foo - regular file
/lib/a.lib
/lib/b.lib
/lib/c.lib
/lib/d.lib
cat /tmp/foo | xargs cp /tmp/fred
cp: target /lib/d.lib is not a directory
...
I have stdin in a select() set and I want to take a string from stdin whenever the user types it and hits ENTER.
But select is triggering stdin as ready to read before ENTER is hit, and, in rare cases, before anything is typed at all. This hangs my program on getstr() until I hit ENTER.
I tried setting nocbreak() and it's perfect reall...
#include <cstdio>
#include <QtCore/QProcess>
int main (int argc, char** argv) {
// if we remove 3 following lines, the problem described below doesn't exists!!
QProcess process;
process.start ("asdqwe"); // doesn't matter what we try to execute here.
process.waitForStarted (1000);
while (true) {
char buf[100];
if (sca...
Hi all,
How to pass python eof to stdin
here is my code
p = Popen(commd,stdout=PIPE,stderr=PIPE,stdin=PIPE)
o = p.communicate(inputstring)[0]
when i run the commd in command line after i input the inputstring windows still expecting a Ctrl+Z to finish accepting input.
How can I pass eof or Ctrl+Z in program?
Thanks!
...