So I want to convert every instance of a \ into \\ for using in a function that creates directories.
string stripPath(string path)
{
string newpath;
for (int i = 0; i <= 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 a string so I'm trying to create a string out of path.at(i). I get an error on Visual Studio that says no instance of constructor matches the argument list. I imported string already.
Here is the documentation for string:at. I'm quite confused because I think I'm doing it right?