stdin

How to capture stdout from another process in win32 without latency?

Hi ! What I'ld like to do is similar to what VS does in its output window or other editors in their tool windows: Start another process B from my process A and capture its stdout/stderr output. So far, I got it working with CreatePipe(), but for some reason, the output of B doesn't arrive at B right when it gets written. It behaves mor...

How write a file to STDIN Stream using DELPHI?

Hi, I need to write a FILE to STDIN. This FILE going to be accessed by another EXE that goig to write the STDIN stream in a microcontroller. Could you give me a help how to write the file to STDIN using Delphi 2010? Thanks very much! Abraão ...

stdin/stdout problem in gcc + rails

...

confused about stdin, stdout and stderr?

Hi, I am rather confused with the purpose of these three files. If my understanding is correct, stdin is the file in which a program writes into its requests to run a task in the process. stdout is the file into which the kernel writes its output and the process requesting it accesses the information from and stderr is the file into whi...

Getting control of std. streams in gcc

How can I get control of the stdin, stdout and stderr streams in gcc.?? We can redirect the error and output to separate files for sure, but is there a way that i can control the stdin such that whenever my program is executing and there is a moment when the stdin waits for a input(either from the user keyboard or any file), it sets a...

node.js: readSync from stdin?

Is it possible to synchronously read from stdin in node.js? Because I'm writing a brainfuck to JavaScript compiler in JavaScript (just for fun). Brainfuck supports a read operation which needs to be implemented synchronously. I tried this: const fs = require('fs'); var c = fs.readSync(0,1,null,'utf-8'); console.log('character: '+c+' ('...

How to detect if Console.In (stdin) has been redirected?

I want to write a console application that have a different behavior depending if the input is coming from keyboard or from, say, a file. Is it possible? What's the most elegant way to do it in C#? ...

How to simply read in input from stdin delimited by space or spaces

Hello I'm a trying to learn python, In C++ to read in string from stdin I simply do string str; while (cin>>str) do_something(str) but in python, I have to use line = raw_input() then x = line.split() then I have to loop through the list x to access each str to do_something(str) this seems like a lot of code just to get eac...

read from stdin for libxml2 in C

Hello, I would like to know the best way to parse a large amount of xml from stdin (data getting piped) into a program I am writing using libxml2. I can parse fine using a reader from the function xmlTextReaderPtr reader = xmlNewTextReaderFilename(filename) when I have a char * to the name of the file. I would preferably like to wind...

Enable console application's output to scripts

Hi, I have a small C++ console application which presents a menu then performs the chosen operation. In addition, I've written a VBScript which runs over the StdOut (achieved by Exec) and enters to StdIn the values. However when I'm trying to executet this script the console application is stuck in the scanf call and the script doesn'...

Read from file or stdin - C

Hello, I am writing a utility which accepts either a filename, or reads from stdin I would like to know the most robust / fastest way of checking to see if stdin exists (data is being piped to the program) and if so reading that data in. If it doesn't exist, the processing will take place on the filename given. I have tried using the...

does anyone have more info on standard in and standard out?

I don't have much of an interest in designing guis (too much work), and I wanna know how it is that programs like vim, and greed work, how is it that vim can modify it's standard out without printing it all out again?, and I often see the output from terminal programs in bright colors, is there some sort of markup language that tells the...

Is there a way to send data to another process's standard input under Mac OS?

Hey guys, I was wondering if there was an API, however obscure it would be, that would allow someone to send data to another process's stdin stream under Mac OS X. Under Linux, if I remember correctly, you can use the filesystem in /proc to access these streams (with the correct permissions, of course). I dunno. Mach ports, anyone? ...

Getting client IP from Ruby script through xinetd

How can I get the client IP Address from inside a Ruby script that is launched by xinetd through a stream socket? In PHP I would just use stream_socket_get_name(STDIN, true); Thanks in advance! ...

Invisible input for passwords?

Possible Duplicate: Read a password from std::cin I want to cin>>input but when they input something i don't want it to be visible to them. Like when you use passwd in unix to change your password where it doesn't show what you typed. i hope it is clear what i am asking. Thank you in advance. ...

Detect if stdin is a tty device (terminal) or pipe in PHP?

I wrote a php script. I want it show help message when called with standard input connected to a tty device (terminal) before reading and executing interactively, but dont show when called with a file or stream from pipe as standard input. Is there a way to detect this from PHP? ...

Setting smaller buffer size for sys.stdin?

I'm running memcached with the following bash command pattern: memcached -vv 2>&1 | tee memkeywatch2010098.log 2>&1 | ~/bin/memtracer.py | tee memkeywatchCounts20100908.log to try and track down unmatched gets to sets for keys platform wide. The memtracer script is below and works as desired, with one minor issue. Watching the inter...

PHP CLI: How to read a single character of input from the TTY (without waiting for the enter key)?

I want to read a single character at-a-time from the command line in PHP, however it seems as though there is some kind of input buffering from somewhere preventing this. Consider this code: #!/usr/bin/php <?php echo "input# "; while ($c = fread(STDIN, 1)) { echo "Read from STDIN: " . $c . "\ninput# "; } ?> Typing in "foo" as the...

Perl: avoid greedy reading from stdin?

Consider the following perl script (read.pl): my $line = <STDIN>; print "Perl read: $line"; print "And here's what cat gets: ", `cat -`; If this script is executed from the command line, it will get the first line of input, while cat gets everything else until the end of input (^D is pressed). However, things are different when the i...

Multi-line input problems when using STDIN.gets

Having looked at this question, I have the following code: $/ = "\0" answer = STDIN.gets Now, I was hoping that this would allow the user to: enter a multi-line input, terminating by pressing Ctrl-D. enter a single line input, terminating by pressing Ctrl-D. enter a "nothing" input, terminating by pressing Ctrl-D. However, the beh...