Simple C question... Hopefully it's simple

Hello. I'm a complete newbie to C programming. I have a C program that wasn't written by me where I need to write some wrappers around it to automate and make it easier for a client to use. The problem is that the program accepts standard input to control the program... I'm hoping to find a simple way to modify the program to also accept input from a text file instead. Can someone please help me with this? I know my post is very vague, but hopefully someone can help guide me. Thanks.

You don't need to modify the program at all, since UNIX lets you redirect standard input to read whatever you please. A simple shell script wrapper can do this, for example:

#!/bin/sh
exec /path/to/program < input_file.txt

Unfortunately redirecting the input to get it from a file doesn't work. It answers the first question correctly, but the answers after that don't get the correct answers...

Without more details, or the code in question, I don't know.

I know it's hard to help me because I'm being so vague. I'm also having a hard time explaining exactly what I need to do without showing the code.

It sounds like you may want a utility called expect - it lets you create fairly complex interactive dialogues with a program - from a script.

expect scripts are easier to create than C code...

The here document - do you know what those are? Will they meet your needs?

Actually, I decided to take a few hours and read about C Programming. I figured out how to approach the code and found a solution. Thank you guys very much for the help.