Hi
>>3-8. After doing some research and reading a good explanation authored by IBM located here:
http://www.ibm.com/developerworks/aix/library/au-unix-getopt.html
I got it working. Now, I have a new question that I can't seem to figure a clear way around: My program doesn't distinguish between options and filenames, when looking for filenames to scan with
fopen(). For example:
prog -a testfile
will properly set the
-a option and function as intended, but instead of then accessing
testfile, it will first attempt to open a file named
-a, which of course does not exist. What would be the best way to circumvent this? All commands are preceded with a minus symbol, and all commands set a
bool in a global argument storage structure as in the IBM tutorial, i.e.
struct globalArgs_t {
int noIndex; /* -I option */
char *langCode; /* -l option */
const char *outFileName; /* -o option */
FILE *outFile;
int verbosity; /* -v option */
char **inputFiles; /* input files */
int numInputFiles; /* # of input files */
}
Thanks for taking the time to read this post.