Process gives no output in stdout
-
I have a program that behaves differently when running it from inside Visual Studio and running the exe file. I am calling the ftp program to transfer a file, and when I run the exe file, the ftp program hardly provides any output at all. The file is transferred all right, but I get no response at all from the ftp progam that it did. This is what the output looks like when I run the program from inside Visual Studio: ----- ftp> Connected to photo.guffa.com. open photo.guffa.com 220 Microsoft FTP Service User (photo.guffa.com:(none)): 331 Password required for guffa. 230 User guffa logged in. ftp> cd UnusedPhotos/large 250 CWD command successful. ftp> put G:\TRIPPER\large\991-11895.jpg 200 PORT command successful. 150 Opening ASCII mode data connection for 991-11895.jpg. 226 Transfer complete. ftp: 257154 bytes sent in 0,25Seconds 1028,62Kbytes/sec. ftp> ftp> close quit ----- This is how it looks when I run the exe file: ---- User (photo.guffa.com:(none)): open photo.guffa.com cd UnusedPhotos/large put G:\TRIPPER\large\991-11895.jpg close quit ----- I built the code from reading the MSDN documentation, then I saw this article: C# corner: Redirecting Standard Input/Output using the Process Class[^], and it doesn't seem like I have forgotten anything. Here is the code that I use to call the ftp program. The tempName string contains the full path of a text file with the commands for the ftp program.
info = new ProcessStartInfo("ftp", "-s:\"" + tempName + "\""); info.UseShellExecute = false; info.RedirectStandardOutput = true; info.RedirectStandardError = true; info.CreateNoWindow = true; process = Process.Start(info); output = process.StandardOutput.ReadToEnd(); error = process.StandardError.ReadToEnd(); process.Dispose();
I display both the output and error strings, so I see that there are no error output from the program either. Anyone got a clue why the program only works when run from inside Visual Studio? --- b { font-weight: normal; }