hi i have a function that opens a file and store the data into a matrix

void openfile(vector<vector<string> >& data, string path) 
{
ifstream inFile;
inFile.open(path);
....

this does not work but it works when i eliminate the path as input

void openfile(vector<vector<string> >& data) 
{
ifstream inFile;
inFile.open("C:\file.csv");
....

i have tried using char path but got the message error conversion from char to const char ..

any help? thanks

open() function takes a char*, not a std::string.

inFile.open(path.c_str());

Got ya. Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.