I have a fortran exe (asos.exe), which outputs a text file in the same
directory as that of the exe. When this exe is invoked individually,
it outputs a text file. I tried to invoke it from .net form, using
shell command / system.dagnostics.process.start, but it writes to the
console and not to the file. In other words my output text file is not
created at all. I want to overcome this problem. My ultimate goal is
to invoke the fortran.exe from VB.net form, and get the result. Can
anyone help me with this code please? thanks in advance.
With smiles,
Deepa Yamini S.
Ken Tucker [MVP] - 27 Jun 2004 19:21 GMT
Hi,
Try this.
Dim p As New Process
Dim SI As New ProcessStartInfo
With SI
.RedirectStandardOutput = True
.UseShellExecute = False
.FileName = "C:\asos.exe"
End With
Dim strOut As String
p = Process.Start(SI)
strOut = p.StandardOutput.ReadToEnd.ToString
Trace.WriteLine(strOut)
p.WaitForExit()
Dim sw As New System.IO.StreamWriter("C:\MyOutput.txt", False)
sw.WriteLine(strOut)
sw.Close()
Ken
--------------------------
> I have a fortran exe (asos.exe), which outputs a text file in the same
> directory as that of the exe. When this exe is invoked individually,
[quoted text clipped - 7 lines]
> With smiles,
> Deepa Yamini S.