What can be done in order to insert arrays into another array. I do happen to have a file which I'm looping through so my goal by now is to take each line within the file and put it into an array (An array of lines). Each line has some data related to a student and his/her tests results, for instance:
Mark Zuckerberg 10.0 5.5 9.7
Bill Gates 10.0 1.5 6.7
Example code:
FILE* file;
char buffer[256];
char arrayOfLines[500];
char line[256];
file= fopen("I:\\students.txt","r+");
/* Helps to iterate through each line */
while (fgets(buffer, sizeof(buffer), file)) {
//some logic to-be-coded
line = buffer; // just an idea does not work
arrayOfLines[i] = line; // just an idea does not work
}
Expected result:
arrayOfLines[] = {" Mark Zuckerberg 10.0 5.5 9.7", "Bill Gates 10.0 1.5 6.7" };
I certainly know this is somehow easy to achieve but after working with java for a long time it turned out to be a little bit tricky, could someone please help me out with this matter? Everything works just fine when it comes to iterating and reading. However, when it comes to "playing" with each line it gets creepy. Perhaps I need to change my approach, any help would be welcomed.