I want to read program content from command line.

Posted by Alexandre Dominos on Stack Overflow See other posts from Stack Overflow or by Alexandre Dominos
Published on 2011-03-18T16:07:02Z Indexed on 2011/03/18 16:09 UTC
Read the original article Hit count: 273

Filed under:
|
|
|

I am trying to update a program which was wrotten in 1995 with pascal or c. I am not sure about programming language. Command line program. Now I am coded in C#. And I want to read program command line content. Is it possible?

I tried something. But not succesfull. They are:

    private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
    {
        // Redirect the output stream of the child process.
        p.StartInfo.UseShellExecute = false;
        p.StartInfo.RedirectStandardOutput = true;
        p.StartInfo.FileName = "osl.exe";
        p.Start();


        logs.AppendText("Timer Started\n");
        timer1.Enabled = true;


    }

    private void timer1_Tick(object sender, EventArgs e)
    {
        // write somethingg and read what is the program doing on command line?
        // What is the program printint? etc... 
        // I try this code but not enough for mo. 
        // logs.AppendText("d:" + p.StandardOutput.ReadToEnd()+"\n");

    }

    private void p_Exited(object sender, EventArgs e)
    {
        timer1.Enabled = false;
    }

i am open to any idea in java,cpp,c,c#.

© Stack Overflow or respective owner

Related posts about c#

Related posts about java