I've trying to test things out to know how they work. We were asked to do an html tag counter program that well, lists the tags used and how many times they appear. So I was trying out fopen to open the file and print the contents first to see if they do work. I still haven't gone to the html-counter part, though. The program below is just to test and make fopen work.
This works and gives the output I want, however, my question is that how come that if I change the data type of the variable c_html to char, I get the warning "comparison is always false due to limited range of data type", while it works with the int data type.
int main(int argc, char **argv)
html_file = fopen(argv, "r" );
printf("Please put an input file.\n"
"Use the syntax: ./a <filename>\n"
"The < and > are not include in the syntax.\n");
c_html = getc(html_file);
if(c_html == EOF)
The warning is for the line "if(c_html == EOF)".
Isn't getc function supposed to give out char? I also used the "%c" when printing, which if I remember correctly, is used for printing character values?
Sorry, if this question is n00bish, but it's been two years since I got a programming subject (and I don't have my resource book right now). Most of my memories of it are washed away.