I've opened a .csv file and saved its contents to a 2-dimensional array. When I try to return its value I get the error mentioned.
Everything works if I don't use the function or if I don't return the array. What is the best way to do this?
string read_csv()
{
std::ifstream file_csv("C:\\DRT\\Lista de Materiais\\Lista.csv");
string csv_temp[600][40]
while (std::getline(file_csv, temp))
{
j = 1;
while (temp != "")
{
pos = temp.find(",");
csv_temp[i][j] = temp.substr(0, pos);
temp = temp.substr(pos + 1, string::npos);
j = j + 1;
}
i = i + 1;
}
return csv_lista;
}
int main()
{
string csv[600][30];
csv = read_csv();
}
C2440: 'return': cannot convert from 'std::string [300][30]' to 'std::basic_string,std::allocator>'