Reading data from a .csv and into arrays in c++
<p>I did some searching on this site and on google as well.  But i couldnt understand a lot of code i seen and im hoping to find more direct help from here. Im only 2 semesters in for c++ and i have a side project id like to do for my boss.</p>

<p>He generates a csv file for call logs and i want to be able to retrieve certain lines from the log and be able to calculate and display data.</p>

<p>Im not sure of the exact questions i need to ask but heres my code where i tried to start getting data but ran into problems (my programming knowledge is fairly limited due to lack of time and experience :)</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;iomanip&gt;

using namespace std;

int main()
{
//opens the csv file.
ifstream gwfile;
gwfile.open("log.csv");

if(!gwfile) { // file couldn't be opened
  cout &lt;&lt; "FAILED: file could not be opened" &lt;&lt; endl &lt;&lt; "Press enter to close.";
  cin.get();
  return 0;
}else
    cout &lt;&lt; "SUCCESSFULLY opened file!\n";

cout &lt;&lt; "-------------------------------------------------------------------------------\n\n\n";

long int SIZE = 0;
char data[SIZE];
cout &lt;&lt; "This is data SIZE:" &lt;&lt; data[SIZE] &lt;&lt; endl;

//in the csv im trying to only read lines that start with the voice as those are only valid data we need.
//also i would like to display the headings in teh very first line
while( !gwfile.eof() ){
    //This is where im trying to only accept the lines starting with "Voice"
    //if(data[SIZE] == "Voice"){
        for( int i=0; i!=","; i++){
            cout &lt;&lt; "This is i: " &lt;&lt; i &lt;&lt; endl; //testing purposes.
        }
    //}
//        getline(gwfile, data, '');
//        cout &lt;&lt; data[0];
}
return 0;
}
</code></pre>
