writing to stdin
Daniel Gerardo Aliaga
dga at cs.brown.edu
Tue May 7 06:14:12 AEST 1991
Is there any way for a process to write a string to its stdin, such that it
can later be read again ?
For example, the following code does the job on SunOS:
#include <stdio.h>
#include <sys/termios.h>
main()
{
static char msge[256] = "hello world";
char buf[256];
int i;
printf("prompt> ");
fflush(stdout);
for (i=0; i<strlen(msge); i++)
ioctl(0, TIOCSTI, &msge[i]);
gets(buf);
printf("input was: %s\n",buf);
}
But we would like to do the same on HPUX or generically on System V.
Thanks in advance.
XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXX Daniel G. Aliaga '91
XXX XXX XXXXX Brown University
XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX "Real men write self modifying code"
More information about the Comp.unix.wizards
mailing list