thethiny thethiny - 19 days ago 5
C++ Question

Raw Strings in Code::Blocks?

I am reading a directory from a file, for example I loaded this

"Main\Characters\Player.xxx"
, so I want to create the folders Main and Characters. I tried using this method (after removing Player.xxx from the string)":

string syntax = "md "+path;
system(syntax.c_str());


However, '\' is counted as an escape and not a backslash, the optimal solution is to replace every '\' with a '\' but that would increase my tool from O(n) to O(2n) given that it needs 30 seconds to fully finish each part. Is there a way to use Raw strings in Code::Blocks? as
R"(\w\\\w)";
didn't do the job for me. (R is not declared in this scope).

Any other solution that doesn't revolve around Raw strings is also welcome.

Answer

Answer 1 - Upgrade to another Compiler. Answer 2 - Simply replace every \ with \

Comments