c++ - Clarification on converting char to string using string::at -
so want convert every instance of \ \\ using in function creates directories.
string strippath(string path) { string newpath; (int = 0; <= path.length() ;i++) { if(path.at(i) == '\\') { string somestring( path.at(i) ); newpath.append(path.at(i)); newpath.append(path.at(i)); } else newpath.append(path.at(i)); } return newpath; }
newpath.append needs string i'm trying create string out of path.at(i). error on visual studio says no instance of constructor matches argument list. imported string already.
here documentation string:at. i'm quite confused because think i'm doing right?
the error concerns call append, should be:
newpath.append(1, path.at(i));
Comments
Post a Comment