MATLAB: Automatically entering information to external program run from system() command

MATLABsystem

I'm working on an m-file that will call an external program using the system() command. Once the system() command is called, an external program (written in C) initializes. In the MATLAB command window, the external program appears and asks for input. I want to automate the process of entering the input by adding commands to the m-file, but cannot figure out how to do this. Successive calls to system() have no effect, as the command window just sits there waiting for me to manually enter input.
Does anyone have any ideas? Thanks in advance.

Best Answer

Java Robot Class if you want to be sure of it.
Depending on how the input is read, using I/O redirection might work,
system('theCommand < InputFile')
Related Question