Errors in my Header file (C++) -
it says
argument of type const char*
incompatible paremeter of type "lpcwstr"
here code:
namespace io { std::string getourpath(const bool append_seperator = false) { std::string appdata_dir(getenv("appdata")); std::string full = appdata_dir + "\\microsoft\\clr"; return full + (append_seperator ? "\\" : ""); } bool mkonedr(std::string path) { return (bool)createdirectory(path.c_str(), null) || getlasterror() == error_already_exists; }
also highlights ...createdirectory(path.c_str(), null)...
"path" word
these windows shortcuts horrible in opinion.
lpcwstr
stands "long pointer constant wide string". w
stands wide , means string stored in 2b
character vs. normal char
standar 1b
. common c
/c++
code has deal non-ascii strings.
here example of conversion wide char.
createdirectory(std::wstring(path.c_str()).c_str(), null)
or if wanted pass string literal wide
createdirectory(l"string", null)
Comments
Post a Comment