[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] Pipes



Hi everyone!

I have a few questions about pipes and such. I am writing two programs
that need to communicate with each other in that way:

prg1 creates a pipe, starts prg2 and waits, until prg2 writes
something into that pipe, then prg2 waits until prg1 writes something
and so on.

My approach was this:
prg1 uses fpipe and passes the file handles to prg2 (cia command
line). But obviously the file handles are not systemwide, so when prg2
tries to use the passed filehandles, it gets an EIHNDL from Fwrite.

So the next thing I tried was this:

prg1 does this:
Fcreate in U:\pipe
Fopen (read & write mode)
Pexec(prg2)
Fread

So at that point prg1 goes to sleep, since there is nothing to read
from the pipe, of course. That is intended.

Now prg2 opens that pipe I created, again in read&write mode. Ideally,
it would write to the pipe, thus waking up prg1, and then make an
Fread itself (and therefore going to sleep, until prg1 writes to the
pipe again and so on).
However, when prg2 tries to write to that pipe, it gets and EACCDN
error code.
Why is that? Is the pipe I created earlier on only unidirectional? If
yes, how do I get a bidirectional pipe?

Or are there any other solutions for the type of communication I want?

Cheers, Ingo =;->