i have a csv file with lots of data. I'm trying to create a 2d array to store this data.
However I have no idea how to do this. This is how far i've got so far...
char a[135][21];
char b[10];
int i=0;
int j=0;
for (j=0;j<22;j++)
{
for (i=0;i<136;i++)
{
a[j][i]=fin.getline(b, 20,',');
}
}
Basically, the data in the csv file starts a new 'row' after the 136th value.
The problem is, I can't take data out of the file and then store it in the array, it won't let me! Can anyone help. Also, the csv file contains letters and numbers.
However I have no idea how to do this. This is how far i've got so far...
char a[135][21];
char b[10];
int i=0;
int j=0;
for (j=0;j<22;j++)
{
for (i=0;i<136;i++)
{
a[j][i]=fin.getline(b, 20,',');
}
}
Basically, the data in the csv file starts a new 'row' after the 136th value.
The problem is, I can't take data out of the file and then store it in the array, it won't let me! Can anyone help. Also, the csv file contains letters and numbers.
Comment