N
nickm687
Hi i have this code below and i need to modify it so i can pass more
than one text file to it. any ideas? i am new to this. thanks in
advance.
Nick
int main(int argc, char *argv[]) {
FILE *f;
int i;
if (1 == argc) {
f = stdin;
} else {
f = fopen(argv[1], "r");
if (! f) {
perror(argv[1]);
fprintf( stderr
, "Couldn't read file %s, dropping this file\n"
, argv[1]);
return errno;
}
}
readFile(f);
printInOrder((Displayer)showEntry,word_tree);
return 0;
}
than one text file to it. any ideas? i am new to this. thanks in
advance.
Nick
int main(int argc, char *argv[]) {
FILE *f;
int i;
if (1 == argc) {
f = stdin;
} else {
f = fopen(argv[1], "r");
if (! f) {
perror(argv[1]);
fprintf( stderr
, "Couldn't read file %s, dropping this file\n"
, argv[1]);
return errno;
}
}
readFile(f);
printInOrder((Displayer)showEntry,word_tree);
return 0;
}