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?

http://www.cplusplus.com/reference/string/string/at/

the error concerns call append, should be:

newpath.append(1, path.at(i)); 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -