stdin

How I redirect python stdout to C stdin using pipelines in linux

I have a python script and I want to use the output of it to be the input of other C program. I want to use pipelines, sintax would be: python_script.py | C_program but I don't know how to redirect the pythons stdout to C stdin ...

How do I capture Chinese input via SCIM with STDIN in Perl?

I use SCIM on Linux for Chinese and Japanese language input. Unfortunately, when I try to capture input using Perl's STDIN, the input is crazy. As roman characters are typed, SCIM tries to guess the correct final characters. ^H (backspace) codes are used to delete previously suggested chars on the command line. (As you type, SCIM tri...

How to use Scanner to read silently from STDIN in Java?

Hi, Is it possible to use the Java Scanner to read from STDIN silently? I mean, without outputting any pressed chars to the terminal? ...

Processing potentially large STDIN data, more than once

I'd like to provide an accessor on a class that provides an NSInputStream for STDIN, which may be several hundred megabytes (or gigabytes, though unlikely, perhaps) of data. When a caller gets this NSInputStream it should be able to read from it without worrying about exhausting the data it contains. In other words, another block of co...

read length of string from stdin

I want to take a string from stdin but I don't want a static array of fixed size I know that scanf need something where save the stdin input, but I can't do something like this: char string[10] scanf("%s",string); becouse I need to know before how long will be the string in order to allocate the right memory space. Can you help me t...

PHP CLI application debug in ZendStudio (STDIN)

0 I am trying to debug php CLI using Zend Studio. My problem: I can't get user input from keyboard. This is part of code (method in some class): public function getInput($promt = null, $defaultValue = null) { if(!isset($promt)){ $promt = self::$DEFAULT_PROMPT; } echo $promt; $stdin = fopen ( "php://stdin", "r" ...

gdb trouble with stdin redirection

Hi, I'm writing a program to implement Dinic's max-flow algorithm over a network. The networks can be written either by hand or loaded from a file using stdin redirection. I've been able to use gdb to debug the program with small files (around 30 lines), but I'm having trouble when I try to debug the program with bigger files (>1000 line...

XML Postback issue

I have a script that is designed to parse XML postbacks from Ultracart, right now just dumps it into a MySQL table. The script works fine if I point it to a XML file on my localhost but using 'php://input' it doesn't seem to grabbing anything. My logs show apache returning 200 after the post so I have no idea what could be wrong or how t...

bash: flushing stdin (standard input)

I have a bash script that I mostly use in interactive mode. However, sometimes I pipe in some input to the script. After processing stdin in a loop, I copy a file using "-i" (interactive). However, this never gets executed (in pipe mode) since (I guess) standard input has not been flushed. To simplify with an example: #!/bin/bash while ...

Capture stdin input without echoing characters to screen

I have a very simple code: char character; std::cin >> character; However, I would like it to behave as follow: Don't echo to console the character I type std::cin should return (unblock) right away when a character is pressed without having to press the Enter key Is this possible? I also have access to Qt. ...

Java -- Read from std input, one char at a time

I'm having trouble determining the best way to read some input in for a java program. It needs to read in the individual characters of a roman numeral, and then perform some operation on it. There are, however, several catches. The input must be read from the standard input, because input redirection is being used. Additionally, I need...

Automated testing of C++ console app in Visual Studio by sending text files to stdin?

Hi, I am going to take part in a coding contest my University is organizining next week. I am only allowed to use C or C++ and I would prefer to use the latter one using Visual Studio 2010. For every task there is a text input provided as plaintext to stdin, for example: 200 100 10 2 11 I need a tool which would assist me with ...

Programmatically read from STDIN or input file in Perl

What is the slickest way to programatically read from stdin or an input file (if provided) in Perl? ...

Is it possible to access the source code of a python script passed to python on standard in?

This is a bit of a random question that is more out of curiosity than any specific need. Is it possible to write some python code that will print some stuff out, including the source code itself, without having the python code stored in a file? For example, doing something like this at the Bash prompt: $ echo ' > print "The Code:" > P...

Ignore backspace key from stdin

I want to make a program that forces it's user to input text but doesn't allow him to erase any of it, what's a simple way of doing it in C? The only thing I've got is (c = getchar()) != EOF && c != '\b' which doesn't work. Any ideas? ...

Piping stdin to ruby script via `myapp | myscript.rb`

I have an app that runs continuously, dumping output from a server and sending strings to stdout. I want to process this output with a Ruby script. The strings are \n-terminated. For example, I'm trying to run this on the command line: myapp.exe | my_script.rb ...with my_script.rb defined as: while $stdin.gets puts $_ end I ult...

Redirect STDIN in bash?

For an example i would like to login to mysql with a password. i KNOW i can use -pmypass but i want to learn how do i redirect stdin in bash. So my test is mysql -u limited_user -p <text to redirect into stdin when it prompts for my pass> I seen < filename before but i dont want to store the data in a file. I tried & and &- but had no...

How to process stdin to stdout in php?

I'm trying to write a simple php script to take in data fro stdin, process it, then write it to stdout. I know that PHP is probably not the best language for this kind of thing, but there is existing functionality that I need. I've tried <?php $file = file_get_contents("php://stdin", "r"); echo $file; ?> but it doesn't work. I'm in...

making python programs "chat" via pipe

Hi! I'm trying to make two processes communicate using a pipe. I did this in the parent process: process = subprocess.Popen(test, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE) process.stdin.write("4\n"); output = process.stdout.read() print output and in the child process: inp = raw_input() integer = int(inp) print int...

Why does fgets(STDIN, 1024) not work anymore?

Question 1 I used to use that line for my PHP parser file for a game server, but it does not work anymore. I know there is the fopen("php://stdin") thing but that's now 3 lines of code instead of just one, why would PHP do this? Question 2 Also, when I use that method I keep getting this output which is causing my script to not read t...