Reputation: 124
I have problem converting a String to std::string, to pass it to my function as the sample of my code is
String dataString = configFile.readString();
rawData = simplifyData("try to fetch data as string from dataString");
Upvotes: 1
Views: 9296
Reputation: 4096
Since std::string
has a constructor accepting a const char*
as parameter you can copy your String
by using this, e.g.:
rawData = simplifyData(std::string(dataString.c_str()));
Or, since this constructor is implict, you can simplify it in your function call, such as
rawData = simplifyData(dataString.c_str());
Upvotes: 6