fgets() appends the '\n' to the end of the string, so you have to truncate it before you can use fname to open the file
fgets(fname ...);
if( fname[strlen(fname)-1] == '\n')
fname[strlen(fname)-1] = 0;
line 36: The answer to your question can be done a couple ways. I would prefer strtok() to extract the words from the line read.
char* word;
word = strtok(line," "); // assume columns are separated by space
while( word != NULL)
{
// do something with this word
//
//
word = strtok(NULL, " "); // get next word
}
Another way is to use a pointer and iterate through the string.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343