in reply to STDIN

The unix 'yes' command prints 'y' or 'yes', depending on your system type, or whatever string you put on the command line to STDOUT. So you should be able to do this...
system("yes y | command");

bluto