I have a piece of code where i read a CSV file and prints it contents. Now the issue is that I want to run my code on ESP32 and because of some limitations of micropython I can't upload my file in the spiffs storage. So is there any way I can store the csv file content in the code itself instead of reading it from the outside?
My code:
vector<vector<double> > read_csv(const char *filename)
{
ifstream read_file(filename);
vector<vector<double> > csv_data;
std::string lineStr;
while (getline(read_file, lineStr))
{
stringstream ss(lineStr);
std::string d;
vector<double> a_line_data;
while (getline(ss, d, ','))
{
a_line_data.push_back(atof(d.c_str()));
}
csv_data.push_back(a_line_data);
}
//cout << csv_data << endl;
return csv_data;
}
This is how i print the contents:
vector<vector<double> > csv_data = read_csv("A00068.csv");
// print tests
printf("CSV:%d\n", csv_data);
printf("SIZE:%d\n", csv_data.size());