I have a function in C++ that takes in an std::istream as the input:
class Foo {
Foo(std::istream &);
}
Using SWIG, I've bound it to Ruby, but Ruby's $stdin variable is fundamentally different from anything like the stream classes in C++, so I'm not sure how to either 1) expose the C++ class to Ruby in a way that I can use $stdin,...
The code below almost works, but it's not what I really meant:
ob_start();
echo 'xxx';
$contents = ob_get_contents();
ob_end_clean();
file_put_contents($file,$contents);
Is there a more natural way?
...
I want to read the lines out of STDIN (aka SYSIN) in COBOL. For now I just want to print them out so that I know I've got them. From everything I'm reading it looks like this should work:
IDENTIFICATION DIVISION.
PROGRAM-ID. APP.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT SYSIN ASSIGN TO DA-S-SYSIN OR...
I have a java app here that starts a C++ app via the java.lang.Process API and then tries to send commands to it via the stdin pipe:
process.getOutputStream().write("foo\n");
process.getOutputStream().flush();
On the C++ side there's a loop running that checks for input in stdin and if there is some
it reads it. Unfortunately the che...
I'm trying to write a Delphi console application that creates a TStream for its standard input, and another TStream for its standard output.
(It will be launched by a host app with its input and output redirected to pipes, and will be passing binary data to/from that host app, so TStream will be much better-suited to the task than ReadL...
I need to run a script and have access to the default stdin (terminal input) in my program. I could do ./program "script", opening and parsing the script through the program, but I want to make it POSIX style, accepting input from pipes or from redirection.
I mean, since my program is a parser, I could run ./program, type the script and...
Hi, I'm looking for a way to have git-commit wait for standard input. I'm coding this in PHP, as my bash skills are non-existant, so I thougth doing a regular
<?php
$input = trim(fgets(STDIN));
fscanf(STDIN, "%d\n", $line);
?>
would do the trick, and wait until I write stuff in to continue, but it just goes ahead and continues executi...
What does it do? I read that it downloads things from Stdin, but where do you actually need it?
Conclusion
some_program | wget -i - -P ./directory
wget gets urls as Stdin from some_program. The input will result in output generated by wget to ./directory.
wget -i ./file
The above command gets urls form ./file, and it generates out...
Is that even possible ?
Lets say that the code has a lot of scanf lines. Instead of manually running and adding values by hand when debugging, is it possible to "feed" stdin with data so that when the scanf starts reading, it will read the inputted data without any need to interact with the terminal.
...
I'm trying to use jsmin with nant - and it just uses stdin and stdout for input and output. The nant 'exec' task allows you to redirect the output to a file, but not get the input from a file.
I have tried with a 'commandline' using '>' and '<' to direct the input and output, but nant just goes away and doesn't come back :(
I can't bel...
I want to run blender from the command line through a ruby script, which will then process the output given by blender line by line to update a progress bar in a GUI. It's not really important that blender is the external process whose stdout I need to read.
I can't seem to be able to catch the progress messages blender normally prints ...
I am using fork() and execvp() to spawn a process that must believe it is connected to an interactive terminal for it to function properly.
Once spawned, I want to capture all the output from the process, as well as be able to send input to the process.
I suspect psuedo-ttys may help here. Does anyone have a snippet on how to do this?...
Hello!
How could I "intercept" Ctrl+C (which normally would kill the process)
in a CLI (command line interface) Java application?
Does a multi-platform solution exist (Linux, Solaris, Windows)?
I'm using Console's readLine(), but if necessary, I could use some other method
to read characters from standard input.
...
I want to run and executable ./runnable on argument input.afa. The standard input to this executable is through a file finalfile. I was earlier trying to do the same using a bash script, but that does not seem to work out. So I was wondering whether Perl provides such functionality. I know I can run the executable with its argument using...
I have a few bash scripts I run, but they can take several hours to finish, during which time they spew out download speeds, ETAs and similar information. I need to capture this information in perl, but I am running into a problem, I cannot read the output line by line(unless I'm missing something).
Any help working this out?
EDIT: to ...
I am using the following conditional statement to read from standard input.
if ((n = read(0,buf,sizeof(buf))) != 0)
When inputting data from standard input, generally the user presses enter when done. But read() considers '\n' as input too in which case n = 1 and the conditional doesn't evaluate to false. Is there a way to make the co...
Using Qt, I'm attempting to read the contents of the stdin stream in a non-blocking fashion. I'm using the QSocketNotifier to alert me when the socket has recieved some new data. The setup for the notifier looks like this:
QSocketNotifier *pNot = new QSocketNotifier(STDIN_FILENO, QSocketNotifier::Read, this);
connect(pNot, SIGNAL(activa...
Related to this question http://stackoverflow.com/questions/1284088/encrypt-binary-with-7z-without-filenames/1284101#1284101
In C# how can i put binary in STDin? i was hoping the below would work but it doesnt. And it makes sense. So how do i push a byte[] array?
new BinaryWriter(p.StandardInput.FormatProvider);
...
I get the error "Not implemented".
I want to compress a file using 7-Zip via stdin then take the data via stdout and do more conversions with my application. In the man page it shows this example:
% echo foo | 7z a dummy -tgzip -si -so > /dev/null
I am using Windows and C#.
Results:
7-Zip 4.65 Copyright (c) 1999-2009 Igor Pavlov 2...
When I execute "python" from the terminal with no arguments it brings up the Python interactive shell.
When I execute "cat | python" from the terminal it doesn't launch the interactive mode. Somehow, without getting any input, it has detected that it is connected to a pipe.
How would I do a similar detection in C or C++ or Qt?
...