![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| simple awk question | orahi001 | UNIX for Dummies Questions & Answers | 2 | 01-11-2008 10:16 AM |
| Ok simple question for simple knowledge... | Corrail | UNIX for Dummies Questions & Answers | 1 | 11-28-2005 01:03 PM |
| Simple FTP question | fundidor | UNIX for Dummies Questions & Answers | 2 | 04-28-2005 09:59 PM |
| a very simple question (but i don't know) | dell9 | High Level Programming | 1 | 10-30-2001 03:37 AM |
| Simple question? | Cuthbert | UNIX for Dummies Questions & Answers | 5 | 07-16-2001 01:00 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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:
Code:
#!/bin/sh exec /path/to/program < input_file.txt |
|
||||
|
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.
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|