in reply to writing to stdin

If you're looking to "pretend" the user has typed a "y", so that she has to back up over it if she wants to change her mind, I'd first consider that to be pretty rude behavior by a program. The normal trick is to accept an empty entry as you would a "y", and show the default as part of the prompt.

However, if you're dead-set committed to pre-typing something for the user, and you're on Unix, you can use the TIOCSTI ioctl to force things into the input terminal (of course, this does nothing for piped or file input). Google around for Perl and TIOCSTI to see some sample code.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.