*sigh* Alright so after some hardcore reading and asking questions I finally damn got it lol. Now I'm not one to start trouble, but it does the same exact thing as my original program, haha. I do see the differences however when it was finally all done. Ill admit, I suck at programming, but when I have my moments damn I'm good lol.
Anyhow I have one more qualm with this program. I put in an else statement for if the file didnt exist, cuz it seemed like a good idea, and it gives me a parse error before 'else'. So what is holding me back this time fellas? Heres the code:
Code:
#include <stdio.h>
int main(int argc, char *argv[])
{
FILE *fp;
char arr[200];
int filename;
int numLines;
const int MAX_LINES = 1;
for (filename=1;filename<argc;filename++)
{
fp=fopen(argv[filename], "r");
if (fp !=NULL) {
for(numLines=1;numLines<=MAX_LINES;numLines++)
{
fgets(arr,200,fp);
fputs(arr,stdout);
}
}
}
else
fprintf(stderr, "The file %s doesn't exist/n", argv[filename])
}
Thanks again guys for the help and putting up with me lol.