I have a program, call it Streamer.exe that streams important real-time data
to the screen.
I've written a program, call it Parser.exe, that expects to read in the data
produced by Streamer, and produce real-time analysis and statistics about
it, which I want put on the screen instead of the garbage code that Streamer
writes.
I've therefore run it as:
C:\> Streamer.exe | Parser.exe
Unfortunately, it seems that the '|' pipe character only sends the data to
Parser after Streamer has finished running. This is not what I'm looking
for, I want to get the data as it's coming out of Streamer, and have Parser
write it to the screen!
Maybe using the pipe isn't the best way to do this? Perhaps using one of the
spawn() varieties from <stdio> or <process> would be better? I'm not
familiar with the spawning, so if someone could help me out with how they
work, that would be great.
I'm writing this in C/C++ using Borland's Turbo C++ v1.01 on a Pentium
system running MS-DOS v6.22.
Please help!
Thanks!
Mike
>Scratch the spawn part, I believe that's only for Win95/NT.
>
>Mike
>
>
--
Take Care -
>
> __
> | / \ \ USA, MI // \\
> \_\\ //_/ Crawling on The Web _\\()//_
> .'/()\'. Charles Angelich / // \\ \
> \\ // | \__/ |
> www.undercoverdesign.com/dosghost
>
Combining the two programs would be the most effective solution.
--
>I have a program, call it Streamer.exe that streams important real-time
data
>to the screen.
<snip>
>I've therefore run it as:
>C:\> Streamer.exe | Parser.exe
>Unfortunately, it seems that the '|' pipe character only sends the data to
>Parser after Streamer has finished running.
Yes, DOS is a single task OS, so it can only run one program until finished.
DOS will put the streamer output in a temporary file, and then use
that for the parser input.
>Perhaps using one of the
>spawn() varieties from <stdio> or <process> would be better?
Because single tasking, spawn will be very similar to exec, ie it will
run the other program until finished, then continue with current one.
H
Mike
"Charles Angelich" <charles_...@hotmail.com> wrote in message
news:acq1td$r940v$3...@ID-128113.news.dfncis.de...
The short answer is "you can't", at least not under straight DOS.
Welcome to the single-tasking world of DOS. DOS emulates pipes by sending
stdout of the first program to a disk file, runs it to completion, and
then runs the next program with its stdin redirected from that same file.
You could, if you felt up to the task, rewrite streamer do act as an
interrupt-driven TSR, stuffing its output into the keyboard buffer. Or,
rewrite both programs to run under some DOS-based multitasker, and have
them communicate via some interprocess communication.
Short of that, get a version that runs on a multitasking system, such
as Unix or Linux.
--
+---------+----------------------------------+-----------------------------+
| Kenneth | kenbrody at spamcop.net | "The opinions expressed |
| J. | http://www.hvcomputer.com | herein are not necessarily |
| Brody | http://www.fptech.com | those of fP Technologies." |
+---------+----------------------------------+-----------------------------+
In other words, what you want is a real operating system with real pipes
and multitasking.
Try Linux.
The definition of Linux is easy:
- Linux is a reimplementation from scratch of an operation system trying to
resemble both Unix branches.
> Interesting .... so e.g. Solaris, HP-UX, AIX and friends are no longer
> Unix either? And Unix is no longer a family of OS'es but merely a
> trademark?
There are multiple definition for "Unix".
The trademark. Afaik Corel/Novel currently owns that. How it is now, I don't
know, but years ago, you had to pay a lot of money, and pass some validation
suite to call yourself "Unix"
Another definition is merely being a direct descendant of the original Unix
code. This e.g. makes the BSDs a real Unix. It doesn't for Unix since it is
a separate independant implementation (but actually took and mimiced quite
some BSD code)
No. It's a Unix-like operating system, but it is not Unix.
The above-mentioned system were never Unix to begin with. They are all
Unix-like systems. Unix has always been a trademark, and you could only
call your system "Unix" with the blessings of the trademark holder, which
would only be done if your system really was Unix and not a lookalike.
I wouldn't say it can't be done in DOS. It just can't be done how
you would like it to be done using pipe.
One solution that comes to mind is to make parser to install
someting to handle output to STDOUT and execute streamer.
Then every time streamer writes something to STDOUT,
parser will get it instantly.
H