![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Reading specific contents from 1 input files and appending it to another input file | sksahu | Shell Programming and Scripting | 5 | 01-14-2009 06:09 AM |
| Reading an Input file and searching for occurrences WIHOUT SED or AWK | kartikkumar84@g | Shell Programming and Scripting | 2 | 05-08-2008 09:16 PM |
| Help reading an input file in KSH | zilla30066 | Shell Programming and Scripting | 2 | 02-01-2007 06:45 AM |
| Script for reading an input file | gzs553 | Shell Programming and Scripting | 1 | 10-17-2006 07:55 AM |
| Reading Input from File and Duplicates Output | noelcantona | Shell Programming and Scripting | 6 | 10-18-2005 05:59 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
reading input from a file
I am trying to read input for a C program (that expects input from the user) from a file using the shell command:
progname < filename but it seems that the program considers the char '<' as the first input, hence causing an "error" in my program. I checked it with another program and it seems to work properly. any idea waht could be wrong? |
|
||||
|
Are you :-
a) taking an argument on the command line and explicitly opening the filename specified in the program? or b) is your C program reading standard input? From your description, it sounds like the program is written assuming (a) but you're attempting to run it assuming (b) i.e. the '<' is causing the shell to open the file and redirect it to your program as STDIN. As Franklin52 says, a code fragment would clarify things. Hope that helps. Jerry |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|