1.

Solve : How to pipe or redirect STDOUT into an EXISTING Console application's STDIN?

Answer» HI,
I want to launch and read the output of a DOS .bat process from WITHIN another programming language (LabVIEW.) if I launch both the DOS-command and my app this way:

MyBat.bat | MyApp.exe

Then MyApp's STDIN does receive the STDOUT of MyBat - MyBat is a .bat file that loops indefinately and updates the CONSOLE (or STDOUT) once a second.

... the trouble is, I need to launch MyBat from within MyApp - which I can do - but how to pipe/redirect MyBat's STDOUT so MyApp can read it?

It's not acceptable to write-to/read-from a disk-file!

Can I use
MyBat > ?
or
MyBat | ?

to write to MyApp's STDIN? - If so, how?

I don't understand the nature of the arguments to the pipe and redirect operators, but wonder if, perhaps, a DEVICE can be defined such that MyBat could pipe or redirect to MyDEVICE, and MyApp could read from it?

Any help is appreciated,
Cheers! Maybe it would help if you could tell us what is the piratical use. Batch files are just that. Batch files. They have limited ability to respond to events. They normally do a sequence of stuff as fast as they can and then quit.
Sometimes an application needs data from the DOS command line. The application can start a 'shell' process that invokes a DOS command and then closes the shell.
But if you have something that returns once a second, maybe it should be a device. The serial port on modern computers can store up to 16 bytes of data without overflow. So you would not need a ISR or DMA if the data were LESS that 16 bytes each time.


Discussion

No Comment Found