Application Input as a "Pipe" not a "flat-File" ???

Application Input as a "Pipe" not a "flat-File" ???

Post by John H. Stockslag » Tue, 21 May 1996 04:00:00



Hello...

If one could point me in the direction of a solution, or simply say
it can't be done, I'd like some help on...

Two applications, (A) and (B).

(A) creates a "flat-file", e.g. - /tmp/output.dat.

When (A) is done, (B) reads the "flat-file".

What I want is for (B) to read the output of (A) as (A) creates
output.

I am familiar with pipes, standard I/O, etc. This is not quite the
case. (B) does not read from Standard I/O (where normal pipes
apply), it reads from an explicitly named file (e.g. -
/tmp/output.dat)

Knowing that UNIX is the end all of file/device-I/O dilemmas, what's
the key?

I hope I haven't been too cryptic in describing my problem...

Thanks!...Later....jhs

-----------------------------------------------------------

 
 
 

Application Input as a "Pipe" not a "flat-File" ???

Post by Bill Campbe » Wed, 22 May 1996 04:00:00



...
: Two applications, (A) and (B).

: (A) creates a "flat-file", e.g. - /tmp/output.dat.

: When (A) is done, (B) reads the "flat-file".

: What I want is for (B) to read the output of (A) as (A) creates
: output.
....
: Knowing that UNIX is the end all of file/device-I/O dilemmas, what's
: the key?

Named pipes.  See the documentation on the mknod command.

Bill
--

UUCP:              camco!bill   2835 82nd Avenue S.E. S-100
FAX:           (206) 232-9186   Mercer Island, WA 98040; (206) 947-5591
http://www.celestial.com/
SPEED COSTS MONEY -- HOW FAST DO YOU WANT TO GO?

 
 
 

Application Input as a "Pipe" not a "flat-File" ???

Post by Youri N. Podchos » Thu, 23 May 1996 04:00:00




Quote:> Hello...

> If one could point me in the direction of a solution, or simply say
> it can't be done, I'd like some help on...

> Two applications, (A) and (B).

> (A) creates a "flat-file", e.g. - /tmp/output.dat.

> When (A) is done, (B) reads the "flat-file".

> What I want is for (B) to read the output of (A) as (A) creates
> output.

> I am familiar with pipes, standard I/O, etc. This is not quite the
> case. (B) does not read from Standard I/O (where normal pipes
> apply), it reads from an explicitly named file (e.g. -
> /tmp/output.dat)

> Knowing that UNIX is the end all of file/device-I/O dilemmas, what's
> the key?

> I hope I haven't been too cryptic in describing my problem...

> Thanks!...Later....jhs

mknod /tmp/output.dat p; A & B /tmp/output.dat; rm /tmp/output.dat

(assuming that A knows where to write its output, and B's input
is to be specified somewhere on the command line)

+---------------------------------------------------------------------+
| Youri N. Podchosov (ynp) * Davidsohn & Son, Inc. NYC * 718-234-4140 |

+---------------------------------------------------------------------+

 
 
 

Application Input as a "Pipe" not a "flat-File" ???

Post by David Whitmar » Thu, 23 May 1996 04:00:00



Quote:>Hello...

>If one could point me in the direction of a solution, or simply say
>it can't be done, I'd like some help on...

>Two applications, (A) and (B).

>(A) creates a "flat-file", e.g. - /tmp/output.dat.

>When (A) is done, (B) reads the "flat-file".

>What I want is for (B) to read the output of (A) as (A) creates
>output.

>I am familiar with pipes, standard I/O, etc. This is not quite the
>case. (B) does not read from Standard I/O (where normal pipes
>apply), it reads from an explicitly named file (e.g. -
>/tmp/output.dat)

It might help to know a little more about the actual problem you are
trying to solve, but one possibility is to use named pipes, otherwise
known as fifo files. Use mknod (I don't have the docs to hand so I
can't give you details - look it up) to create a fifo called
/tmp/output.dat, (A) writes to it, (B) reads from it. (B) doesn't have
to be running to start (A), but (A) will block if nothing reads the
FIFO. Similarly (B) will block when nothing is writing.

If, on the other hand, the objective is to pipe data and record the
pipe contents in a file, then use tee.

Hope this helps,

David
----------------------------------------------------
David Whitmarsh

     Accession Systems Ltd/Sparkle Computer Co Ltd

     Client/Server development and consultancy:
          Unix, Sybase, C, Powerbuilder, Delphi
----------------------------------------------------