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 in/out-Put to Streams in DOS-Box-like utility

Process in/out-Put to Streams in DOS-Box-like utility

Scheduled Pinned Locked Moved C#
testingbeta-testingtoolsjsonquestion
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.
  • J Offline
    J Offline
    J Holzer
    wrote on last edited by
    #1

    Hi! I´m currently programming a GUI for a Command-Line-Based System. The administration is done with a command-line-Admin-Tool similar to Windows´ CMD-Dos-Box. Unfortunately i cannot run the admin-commands on their own, because the only run in this cmd-line-based gui, which seems to be an stand-alone interpreter, not a dos-box running seperate programs... Also there is no API available i could use. What i´d like to do is to call a DOS-Box/Admin-Tool via the Process-Object and send my commands to it via the StandardInput-Object. Sending works fine, but when I do the reading from StandardOutput-Stream, i cannot find an end-mark for my while-Statement. (For testing-purposes i send everything to the system-console in order to see, what comes back from my process) string sto = null; string ste = null; while ( ((sto = process.StandardOutput.ReadLine()) != null) || ((ste = process.StandardError.ReadLine()) != null) ) { if (sto != null) System.Console.WriteLine(sto); if (ste != null) System.Console.WriteLine(ste); sto = null; ste = null; } When the command has finished, the loop hangs in the ReadLine-Statements. Peeking into the stream doesn´t work and hangs also... How could i do this? Thanks a lot! J. -- modified at 9:43 Thursday 16th February, 2006

    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