Redirecting program output straight to an edit control

This is a discussion on Redirecting program output straight to an edit control within the C++ Programming forums, part of the General Programming Boards category; I know you can redirect program output to a file, but can it be redirected into a program? I want ...

  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.
    benforbes@optusnet.com.au
    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,796
    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?
    benforbes@optusnet.com.au
    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,796
    >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
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,699

  6. #6
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Thanks, I'm working through it as we speak.
    benforbes@optusnet.com.au
    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, 10: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, 08:59 AM
  4. Problems with my edit control...
    By tyouk in forum Windows Programming
    Replies: 19
    Last Post: 10-19-2003, 01:36 AM
  5. Edit Control
    By sean345 in forum Windows Programming
    Replies: 0
    Last Post: 07-08-2002, 05:22 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21