Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Process gives no output in stdout

Process gives no output in stdout

Scheduled Pinned Locked Moved C#
csharpvisual-studiocomhelpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Guffa
    wrote on last edited by
    #1

    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; }

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups