Interfacing a c prog with a shell prog

Interfacing a c prog with a shell prog

Post by Arnaud Megre » Fri, 13 Aug 1999 04:00:00



Can somebody help me?

I have a C programm that communicates with the user by reading from
standard input and writing to standard output (printf, scanf). I would
like to interface this programm with a shell that will replace
the user automatically (that is communicating with my C programm).

How can I do?

I have tried to lanch my C prog in background (&) and redirecting
standard input and output into named pipes. And It works fine but
randomly it stops!!!!!!
(I used fflush() in my C prog after each printf() and a loop for each
scanf() waiting for non negativ return code.)
I work Under AIX 4.3.2

I would be very gratefull for any help!

 
 
 

Interfacing a c prog with a shell prog

Post by Bryan VanDeVe » Fri, 13 Aug 1999 04:00:00



> Can somebody help me?

> I have a C programm that communicates with the user by reading from
> standard input and writing to standard output (printf, scanf). I would
> like to interface this programm with a shell that will replace
> the user automatically (that is communicating with my C programm).

Though I have not had much direct experience with it myself, I know that
what you want is a program called "Expect":

http://expect.nist.gov/

--
Bryan Van de Ven
Applied Research Labs
University of Texas, Austin