home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / os / mswindo / programm / misc / 988 < prev    next >
Encoding:
Text File  |  1992-07-23  |  2.1 KB  |  45 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!monu6!steve
  3. From: steve@monu6.cc.monash.edu.au (Steve Balogh (+61 3 565 4747))
  4. Subject: Re: Capturing DOS output?
  5. Message-ID: <1992Jul24.052054.24347@monu6.cc.monash.edu.au>
  6. Organization: Monash University, Melbourne, AUSTRALIA
  7. References: <rcgmm3l.jfh@netcom.com>
  8. Date: Fri, 24 Jul 1992 05:20:54 GMT
  9. Lines: 34
  10.  
  11. In article <rcgmm3l.jfh@netcom.com> jfh@netcom.com (Jack Hamilton) writes:
  12. >I'd like to run a DOS application from inside a Windows application, and
  13. >have the output from the DOS program appear in a window controlled by my
  14. >Windows program.
  15. >
  16. >I looked at WinExec, but there's nothing obvious in the documentation.  Is
  17. >there some other way to do it?
  18. >
  19. >By the way, I'd like the window to scroll as the DOS program creates more
  20. >output (which will be to stdout), so redirecting the output to a file and
  21. >then displaying the file won't do what I want. 
  22. >
  23. >While I'm asking for the impossible, can I capture stderr separately? 
  24. >
  25.  
  26. I am doing a similar thing in a program I am writing. The method I use is to
  27. redirect the stdout of the dos program to a temporary file (preferably on a
  28. RAM disk) and then open the file on a 1 second WM_TIMER message. Read the file
  29. until it hits EOF, save the current location within the file, and then close it.
  30. The next time I open the file, I then seek to the saved location and then read
  31. till EOF again. I keep repeating this procedure until the displying window is
  32. closed by the user. The method appears to act like the Unix "tail -f" command.
  33.  
  34. I don't think this is the best way to achieve this task, but it is the best that
  35. I have come up with so far. Any better methods would be appreciated. Let me
  36. know if you find one. :-)
  37.  
  38. Steve
  39.  
  40. ----_--_-_-_--_-__-_------_-__---_-___-_----_-____-_-_--__-_--_--___-_-_-_--__-_
  41. Steve Balogh  VK3YMY   (Maths G.14)   | steve@monu6.cc.monash.edu.au
  42. Monash University, Clayton Campus     |      37 54'38.8"S  145 07'47.1"E ...ICBM
  43. Wellington Road, Clayton.            |      +61 3 565 4747 Voice (Office)
  44. Melbourne, AUSTRALIA. 3168          |      +61 3 565 4746 Fax
  45.