Ah, thank you! It worked!
But for some reason it's not reading the whole config file. My first post had different code than what I have now:
In my config file:
Code:
italic
bold 0;31 # red
iTAlic 0;34 # this is the line in effect for italic
underline 0;32 # green
italic 0;35 # overriden by line 3
In my code:
Code:
int main(void) {
FILE *configFile;
FILE *htmlFile;
char possibleTags[NTAGS][TAGLEN];
char ascii[BUFSIZE][BUFSIZE];
char extra[BUFSIZE][BUFSIZE];
char buffer[BUFSIZE];
int i = 0, n = 0, spaceCount = 0;
/*******************************************
** READ CONFIG FILE FOR POSSIBLE TAGS
********************************************/
if((configFile = fopen(CONFIGFILE, "rb")) == 0) {
perror("fopen\n");
exit(1);
}
while ( fgets(buffer, sizeof(buffer), configFile) != NULL ) {
for(i = 0; buffer[i] != '\0'; i++) {
buffer[i] = tolower(buffer[i]);
if(isspace(buffer[i])) {
spaceCount++;
}
}
if(spaceCount >= 2) {
fscanf(configFile, "%s %s %s", possibleTags[n], ascii[n], extra[n]);
n++;
}
}
fprintf(stdout, possibleTags);
fclose(configFile);
return 0;
}
When I use the fprintf to output the array, it only displays "bold" as one of the tags it scanned.