I came across a problem in which I need to load data from a text file, and than save it into an array of string type. My approach is to consider the array as a 2D array, but of char type.
This is my code:
string *rollno;
rollno=new string[2];
string line;
ifstream in("file.txt",ios::app);
int i=0;
char single;
in.get(single);
while (single != '.') {
    for (int j=0; single!=',' || single!='.'; j++) {
        rollno[i][j]=single;\\saving in array character wise
    }
    in.get(single);\\getting the next line 
    i++;
}
cout<<rollno[0]<<endl<<rollno[1];\\checking
Could anyone help me figure out what I'm doing wrong?
 
     
    