I think it is more complex than this.
Just like this person's problem, I also needed something where I can
re-directed I/O to my CVI program. The problem is that you need to re-direct
both input & output to your DOS program in such a way that you can send
commands to already running DOS exe from your CVI program and capture
response coming back (as they come, not after the fact) and display them on
your CVI screen or do something based on the response.
If it was just that I send bunch of commands in a batch mode and looked at
the output when the DOS program finished, it is easy, like you said, by
using files. But most of time when people are asked to put CVI on top on a
DOS program, they need to control it interactively, just like some one was
sitting there, typing these commands and looking at the reponses.
Now Tcl/Expect is really good with this as it let's you get a handle to a
process and you just read/write to it, like a file. You get events if there
is some output. I had put this question earlier and someone had replied
about a VC++ library to do this. Here is that info. I haven't tried it
myself yet.
*****************************
Al Stevens created a C++ class to do this called ConsoleApp and described
how it
works in Oct '02 DDJ.
It uses the Win32 API call CreateProcess which let you substitute your own
file
handles for the console app's stdin and stdout.
You can download the original code from here:
http://www.ddj.com/ftp/2002/2002_10/cpro1002.zip
The latest updates can be found here:
http://www.alstevens.com/quincy.html
Nick
*****************************
vishi
"Al S" wrote in message
news:50650000000500000035D30000-1042324653000@exchange.ni.com...
> By using DOS re-direction of I/O, you can store all the messages in a
> file, and read them from the file after the DOS program ends.
> If your normal command is
> procmd x y z
> re-direct the I/O to a file by using
> procmd x y z > msgfile.txt
> msgfile.txt will be a text file containing any messages that procmd
> normally displays on the screen.
> When redirecting I/O, a single > creates a new file or overwrites an
> existing file. >> appends to an existing file (or creates a file if
> the filename didn't exist).
> Before you attempt to read the file in your CVI program, make sure the
> launched application is complete: system() waits for the command to
> exit; LaunchExecutable() doesn't wait.