I am very new when it comes to C and C++ as well as the fact that I haven't touched the language in over a year so I am having some trouble trying to figure out the syntax/logic for this particular problem I am having. Here is the fragment of code I am having trouble with:


1 #include <stdio.h>
2 #include <string>
3 int main (void)
4 {
5 FILE *inputFile;
6
7 char fe[6]="1.csv";
8 char reader[1];
9
10 if ((inputFile = fopen(fe, "r")) == NULL)//r reads from the file pointer
11 {
12 printf("Error opening input file\n ");
13 exit(1);
14 }
15
16 for (int i = 0; (i <= 247); i++)
17 {
18
19 while(reader[i](inputFile)!=','||'\0'){
20 fscanf(inputFile,"%s",&reader[i]);
21 }
22 }
23
24}

What I am trying to do is parse through a CSV file and each set of data is seperated by a comma so I figured I could make a while look that will keep inputting the data into the string until it reaches a comma then increment "i" once more. This particular piece of code is just to skip through the file. I am sure this is an easier way to do this but I don't know it. The only real problem is line 19 I don't know how to write it so that the while loop will be looking at the file output.
Thanks for the help