Create folder from variable name
Hi all
I have searched for this answer but can't find any posts regarding this particular problem.
I want to create a folder based on a string variable that I have assigned, but cannot figure out how. There are many examples using functions such as:
system("MD NewFolder") or
mkdir("NewFolder) etc
However I want the name of the folder to be based on a string variable that I have assigned e.g.
string fldname = "XYZ";
mkdir(fldname);
however this gives an error...
main.cpp cannot convert `std::string' to `const char*' for argument `1' to `int mkdir(const char*)'
Could someone please give me an idea of how I should go about this. Another point to note - I am writing this on a windows platform, but will then need to compile on UNIX so the system() function would need to be modified if I go with that solution.
Thanks