Re: Windows Console Output
- Posted by jacques deschênes <desja at ?lobetrotter.net> Sep 23, 2007
- 540 views
don cole wrote: > > jacques deschênes wrote: > > > > As I often use console command at work, usualy I send the output of the > > command > > to a file then I use an euphoria script to extract the information from that > > file. > > example: > > net view > net_view.txt > > exwc xtract_hosts_names.exw net_view.txt hosts.txt > > > > For a long time I have been thinking about writing a library to capture > > console > > i/o but never took the time to do it. > > But from you question I made some search on MSDN and found a C sample code > > that > > show how to do it and decided to write capture.e > > the interface would look something like it. > > fnVal = CaptureRun(sequence command_arg,integer Option) > > command_arg should be a string with the command and its arguments > > Option should be one or more of CAPTURE_STDIN, CAPTURE_STDOUT, > > CAPTURE_STDERR > > ored togethers. > > fnVal would be Process Information in a sequence or -1 if CaptureRun failed > > Contrary to system() or system_exec() CaptureRun() will return immediately > > So a dialog could be engaged between the parent process and the child > > process. > > > > jacques d. > > > > > > Hayden McKay wrote: > > > > > > jacques deschênes wrote: > > > > > > > > > > > > Hi Hayden, > > > > If the console app you launch is one that you build yourself in > > > > euphoria, then > > > > the following procedure would do it. > > > > > > < snip > > > > > > > no, the console app is in some other language. it's open source so maybee > > > i > > > could modify then recomile but it would be better for me just to capture > > > the > > > output and proccess it with euphoria. > > > > > > BTW, thanks for link to CreatePipe() stuff > > Hello jacques, > > I too am very interested in this. As I would like to convert the console > window > to a text file for printing purposes. If posible I would like to see the > complete > code in Euphoria of course. I don't know much about C. > > > Don Cole I spent many hours today working on capture.ew its almost done. I should be able to post it to rapideuphoria.com before monday. let to be done: code cleanup and testing features: - 100% euphoria code - can capture child process stdin (main process can pipe output to its child handle 0) - can capture child process stdout (main process capture child console output sent to hamdle 1) - can capture child process stderr (main process capture child error messages sent to handle 2) - can capture any combination of 3 above. - very simple interface - capture_exec(cmd_line,option) - capture_gets(handle) - capture_puts(handle, object data) - capture_terminate() regards, Jacques Deschênes