Hi
My program is rather simple, or I thought it would be rather simple :P
My program reads a text file & saves each line of text into an array called buffer.
The problem is; each line of text is not in a separate array, the whole text file is in one array.
Any suggestions on how to save each line of text in a different array element? :)
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int main ()
{
int counter = 0;
char* buffer[999];
ifstream myfile ("music.txt.windows");
while (myfile)
{
myfile.getline(buffer[counter],'\n');
counter++;
}
cout << counter << endl << endl;
for (int i=0; i< counter; i++) {
cout << buffer[i] << endl;
}
return 0;
}