Thread: Redirecting program output straight to an edit control

  1. #1
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401

    Redirecting program output straight to an edit control

    I know you can redirect program output to a file, but can it be redirected into a program? I want to display a program's output in an edit control while the program is running.
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Use a pipe. Check your compiler's documentation for something like popen or _popen
    My best code is written with the delete key.

  3. #3
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    So I guess I would just read from the pipe at regular intervals and update it that way, is that right?

    Another question. Would it be feasible to create another thread to monitor the pipe at all times? The thread could post a message to the main thread when new data is received. Would that improve performance at all?
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >So I guess I would just read from the pipe at regular intervals and update it that way, is that right?
    Pretty much. A pipe is treated in much the same way as any other stream.

    >Would that improve performance at all?
    Possibly, but I don't see too much gain for the work involved unless the command invoked by the pipe uses processor intensive computations or takes user input and the program using the pipe needs to do other work while the command is running.
    My best code is written with the delete key.

  5. #5

  6. #6
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Thanks, I'm working through it as we speak.
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 06-05-2009, 09:42 AM
  2. Replies: 3
    Last Post: 02-29-2008, 01:29 PM
  3. Dialog Edit Control and Enter Key
    By Quantrizi in forum Windows Programming
    Replies: 2
    Last Post: 04-14-2004, 07:59 AM
  4. Problems with my edit control...
    By tyouk in forum Windows Programming
    Replies: 19
    Last Post: 10-19-2003, 12:36 AM
  5. Edit Control
    By sean345 in forum Windows Programming
    Replies: 0
    Last Post: 07-08-2002, 04:22 PM