capture output from cammad line argument

  • Thread starter Thread starter Guest
  • Start date Start date
lkr said:
how to capture java output from cammand line agrument using c#

Could you explain in a bit more detail? It's not obvious what you mean.
 
hi Jon
v r doing a editor in C# for compilation of c c++ and java.Simply open the
file and execute it...
here is the code
//////////////////////////starting the execution
here//////////////////////////
private void Execute_Click(object sender, System.EventArgs e)
{
try
{
Process chk = new Process();
string str_txtbx= txtbxCmd.Text;//compilation command
string str_txtbx1= txtbxPath.Text;//Path of the file to be
executed
if(str_txtbx1=="")
chk.StartInfo.FileName=str_txtbx;
else
{
chk.StartInfo.Arguments=str_txtbx1 ;
chk.StartInfo.FileName=str_txtbx;
}
MessageBox.Show("ERR TRy->"+ str_txtbx1 );

chk.StartInfo.UseShellExecute = false;
chk.StartInfo.RedirectStandardOutput = true;
chk.Start();
chk.WaitForExit();

string output = chk.StandardOutput.ReadToEnd();
MessageBox.Show(output);//

}
catch (Exception e1)
{
MessageBox.Show("ERR ->" + e1.ToString());
}
}

//////////////end///////////////////////////////////////
But here from StandardOutput Stream we r not able to read.But process is
executing fine.
Actually after the execution the output of the program v have to display in
the form. How can this possible?
Expecting ur reply.............
lkr
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top