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. console app wrapper help [modified]

console app wrapper help [modified]

Scheduled Pinned Locked Moved C#
helpcsharpc++com
3 Posts 2 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.
  • M Offline
    M Offline
    mbender
    wrote on last edited by
    #1

    I am currently tasked with providing a friendlier user interface here at work that will provided new features, but also will interact with several console apps. I need to be able to read/write to these applications. The key is being able to read and write multiple times to the same process. I understand that I could use batch files for this but this will not provide the real-time feedback and interaction that I need to pull this off cleanly. I am a former VB6 developer that has been using C# for a short time now. I have written similar applications to this one in VB6 using a DLL written by Franky Braem (http://www.codeproject.com/atl/redirect.asp). This worked great and is what I need to recreate in C#. I have a code that is capable of reading and writing to the console using the System.Diagnostic namespace redirecting stdin, stdout and stderr (single thread). My issue with this code is that I have to close the StreamWriter of the process in order to read the stdout. Due to this when I attempt to send a subsequent string to the console I get an error that the TextWriter has been closed. Can I reopen this? I cannot locate anything on doing this. I played with a second example written by Scott Hanselman (http://www.hanselman.com/blog/SoManyMistakesForMeToMakeSoLittleTimecapturingStandardErrorAndStandardOutput.aspx) that is multithreaded. This exhibits the same behavior described above. In reality I would really like a C# version of Franky Braem's redirect DLL in C#. Any help here will be greatly appreciated! Thanks -- modified at 15:18 Friday 14th September, 2007 * Made clarifications

    L 1 Reply Last reply
    0
    • M mbender

      I am currently tasked with providing a friendlier user interface here at work that will provided new features, but also will interact with several console apps. I need to be able to read/write to these applications. The key is being able to read and write multiple times to the same process. I understand that I could use batch files for this but this will not provide the real-time feedback and interaction that I need to pull this off cleanly. I am a former VB6 developer that has been using C# for a short time now. I have written similar applications to this one in VB6 using a DLL written by Franky Braem (http://www.codeproject.com/atl/redirect.asp). This worked great and is what I need to recreate in C#. I have a code that is capable of reading and writing to the console using the System.Diagnostic namespace redirecting stdin, stdout and stderr (single thread). My issue with this code is that I have to close the StreamWriter of the process in order to read the stdout. Due to this when I attempt to send a subsequent string to the console I get an error that the TextWriter has been closed. Can I reopen this? I cannot locate anything on doing this. I played with a second example written by Scott Hanselman (http://www.hanselman.com/blog/SoManyMistakesForMeToMakeSoLittleTimecapturingStandardErrorAndStandardOutput.aspx) that is multithreaded. This exhibits the same behavior described above. In reality I would really like a C# version of Franky Braem's redirect DLL in C#. Any help here will be greatly appreciated! Thanks -- modified at 15:18 Friday 14th September, 2007 * Made clarifications

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      mbender wrote:

      then I need to know how to write to the Textbox control from a different thread.

      Have you searched for information on that? Have you tried the C# threading tutorial here on CodeProject?

      M 1 Reply Last reply
      0
      • L led mike

        mbender wrote:

        then I need to know how to write to the Textbox control from a different thread.

        Have you searched for information on that? Have you tried the C# threading tutorial here on CodeProject?

        M Offline
        M Offline
        mbender
        wrote on last edited by
        #3

        Sorry got the thread issue resolved. What I cannot get is a class that acts like the redirect library referenced at the beginning.

        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