Reputation: 5382
Very new to C++ and when I compile I get this error:
error: invalid conversion from ‘void*’ to ‘char’
What on earth does this mean? I presume it's something memory related, I have not initiated the array or something along those lines?
Here is my code:
char students[150][150];
int main()
{
readFile();
}
void readFile()
{
string line;
ifstream file("scores.txt");
for(int i = 0; i < 150; i++) {
for (int x = 0; x < 150; x++) {
students[i][x] = getline(file, line, ' ');
}
}
for(int i = 0; i < 150; i++) {
cout << students[i][i];
}
}
Upvotes: 0
Views: 833
Reputation: 1736
getline returns a basic_istream, and you can't set it to the type char
Upvotes: 4