output

System.Diagnostics.Process to run processes, send parameters and get output

Hi, I am trying to call a process using System.Diagnostics.Process, send it a parameter, just for the sake of trying it out i am sending "-h" which should generate a list of help options and I need the output. So far I have tried, ProcessStartInfo startInfo = new ProcessStartInfo("C:\\agfl\\agfl.exe"); startInfo.Windo...

How can I concatenate corresponding lines in two files in Perl?

file1.txt hello tom well file2.txt world jerry done How to merge file1.txt with file2.txt; then create a new file - file3.txt hello world tom jerry well done thank you for reading and reply. Attached the completed code which based on the answer. #!/usr/bin/perl use strict; use warnings; open(F1,"<","1.txt") or die "Cannot op...

Capturing stdout within the same process in Python

I've got a python script that calls a bunch of functions, each of which writes output to stdout. Sometimes when I run it, I'd like to send the output in an e-mail (along with a generated file). I'd like to know how I can capture the output in memory so I can use the email module to build the e-mail. My ideas so far were: use a memor...

How to redirect output of PHP script DURING execution?

Is there a way to redirect output of an executing PHP script? Of course this is trivial when launching the script via the command line. But how is this accomplished after the script is started? Note: I need to capture the syntax errors and such as well. ...

How to have one PHP script launch another and capture its output?

This is a little tricky so bear with me: I have a PHP script a.php that is launched from the command line and data is provided to it via STDIN I have another PHP script b.php I want to have a.php launch b.php and capture its output. Also, a.php has to forward the STDIN to b.php Is there an easy way to do this? ...

writing into a file in c.

i have an char array b[20] which i want to write into a file . After every iteration the value of b[20] changes , so i would like to write the string in each line of the file in each iteration . So how can i change a new line in a file and also put in a array of character? ...

Using a handle to collect output from CreateProcess()

Hi I am using CreateProcess() to run an external console application in Windows from my GUI application. I would like to somehow gather the output to know whether there were errors. Now I know I have to do something with hStdOutput, but I fail to understand what. I am new to c++ and an inexperienced programmer and I actually don't kn...

How do I echo $command without breaking the layout

Hi. I'm trying to do the following in a bash script: com=`ssh host "ls -lh" ` echo $com It works, but the echo will break the output (instead of getting all lines in a column, I get them all in a row). If I do: ssh host ls -lh in the CLI it will give me the correct output + layout. Any ideas? ...

file output in python giving me garbage

When I write the following code I get garbage for an output. It is just a simple program to find prime numbers. It works when the first for loops range only goes up to 1000 but once the range becomes large the program fail's to output meaningful data output = open("output.dat", 'w') for i in range(2, 10000): prime = 1 for j in r...

How to pass output of a linq query to another form in C#

I have a Linq query and I want to pass the ouput (userid) to another form for further processing. var userid = from auser in allusers.Users where auser.Username == nameString select new { id = auser.UserId }; so only 'UserId' is stored in variable 'userid' and I want to use this value in another form. Is there any way we can ...

Why is my PHP string being converted to 1?

Ok, so here's the quick rundown. I have a function to generate the page numbers. This: <?php die($ani->e->tmpl->pages("/archive", 1, 15, 1, true)); ?> will output Single Page like expected. But this: <?php $page_numbers = $ani->e->tmpl->pages("/archive", 1, 15, 1, true); ?> <?= $page_numbers ?> will output a simple 1 to the page....

C# Speaker Output Device *Advanced* Settings

Hello all. I have a C# (WPF) application which checks for all output devices (Speakers) and I need to check the Bit Depth and Sample Rate of the output device. Has anyone worked with this or know of a way to do so? I have been searching around, but found nothing similar... Any help is much appreciated. Thanks ...

Redirecting multiple stdouts to single file

I have a program running on multiple machines with NFS and I'd like to log all their outputs into a single file. Can I just run ./my_program >> filename on every machine or is there an issue with concurrency I should be aware of? Since I'm only appending, I don't think there would be a problem, but I'm just trying to make sure. ...

Log Unittest output to a text file

Hello, I am trying to log the output of tests to a text file. I am using the unittest module and want to log results into a text file instead of the screen. I have some script here to explain what has been tryied so far. This is the test script. import unittest, sys class TestOne(unittest.TestCase): def setUp(self): self....

Output problem in mysql query in MFC program

I'm currently working on a small MFC program that outputs data from a mysql database. I can get output when i'm using an sql statement that does not contain any variable eg. select album from Artists; but when i try to use a variable the program compiles but i get no output eg. mysql_perform_query(conn,select album from Artists w...

Can I use an <asp:SessionParameter Direction="Output"/> to *set* a variable?

If I have a SqlDataSource with InsertCommand="INSERT [Applications] ([UserID]) VALUES (@UserID);SELECT @ApplicationID=SCOPE_IDENTITY()" Can I use a SessionParameter to store the returned value? <asp:SessionParameter SessionField="__ApplicationID" Name="ApplicationID" Type="int32" Direction="Output" DefaultValue="-1" /> ...

Bourne Script: Redirect success messages but NOT error messages

This command: keytool -import -file "$serverPath/$serverCer" -alias "$clientTrustedCerAlias" -keystore "$clientPath/$clientKeystore" -storepass "$serverPassword" -noprompt Will when it runs successfully outputs: Certificate was added to keystore I tried redirecting the stdard out with: keytool ... > /dev/null But it is still prin...

Can I get a faster output pipe than /dev/null ?

Hi I am running a huge task [automated translation scripted with perl + database etc.] to run for about 2 weeks non-stop. While thinking how to speed it up I saw that the translator outputs everything (all translated sentences, all info on the way) to STDOUT all the time. This makes it work visibly slower when I get the output on the co...

MATLAB postpones disp calls when doing demanding calculations. Why is that?

I am implementing an algorithm in MATLAB. Among other things it calculates the shortest paths etc. so it's quite demanding for my old computer. I've put in disp() calls through out the program to see what's happening all the time. However when starting on a particulary heavy for loop the disp() seemes not to be called until the loop is...

Operator issues with cout

I have a simple package class which is overloaded so I can output package data simply with cout << packagename. I also have two data types, name which is a string and shipping cost with a double. protected: string name; string address; double weight; double shippingcost; ostream &operator<<( ostream &output, const Pa...