Click to See Complete Forum and Search --> : Reading in Console data
DaddyGweedo
August 2nd, 2002, 03:07 PM
I am wondering if it is possible to write a VB.NET console application that can run another console application and read in the console output from that second app...
For instance:
program 1 runs and starts program 2.
Program 2 writes (to the console) a series of numbers.
program 1 reads in those numbers and performs a calculation on them.
Is this possible, and Do you have any idea how I would go about it?
:confused:
Brad
DSJ
August 5th, 2002, 05:34 PM
I don't think this will work because the called app will run in a different "console" (I think). One solution would be to write the numbers to a file though.
DaddyGweedo
August 5th, 2002, 08:37 PM
It's not really an option since I didn't write the console app.. What I want to do is read in the output generated by another console app and then run some calculations on it... Seems like it might be impossible.
DSJ
August 6th, 2002, 09:01 AM
You can re-direct the output using > or >> to send it to a textfile... for example:
dir > my.txt
Will write the directory listing to my.txt or
dir >> my.txt
Will APPEND the directory listing to my.txt
so try
YourApp.EXE > sometextfile.txt
and see what you get.
DaddyGweedo
August 6th, 2002, 09:25 AM
That might work if I use a batch file and then call my program... It's for a scheduled program.
Thanks!
lhg
August 9th, 2002, 04:26 PM
you can use pipe to send data from one program to another
program,I know c can. I believe vb.net should can do that
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.