I have a problem with my newly application where i want to execute a c/java program file. And after executing the file i want to work with the output of that file. Please anybody give me the solution for that how can i do this?

To launch the c/java from c#, assuming is an exe file, or the file extension has a 'open with' configured on your system, you can use some thing like

var fileToLaunch = "SomeFilePathHere";
var process = new Process();
process.StartInfo = new ProcessStartInfo()
{
    UseShellExecute = true,
    FileName = fileToOpen
};

process.Start();
process.WaitForExit();

then to open the resulting file, you can use a stream reader like:

StreamReader streamReader = new StreamReader(resultingFilePath);
string text = streamReader.ReadToEnd();
streamReader.Close();

You shall need project references for the System.Diagnostics and The System.IO namespaces

Hope this helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.