0
我正在創建一個VC++ 2008 Windows窗體應用程序,它需要使用我們的VC6項目中的一些類。將代碼從VC++ 6移動到VC++ 2008時出錯
當我增加了一個文件,其中包含下面的方法:
bool Property::createPaths(string &sPaths)
{
char *tok = NULL;
char seps[] = "\\";
string str;
if (sPaths.size() > 0)
{
tok = strtok((char*)sPaths.c_str(),seps);
str = tok;
while (tok != NULL)
{
int res = CreateDirectory(str.c_str(),NULL);
tok = strtok(NULL,seps);
if (tok != NULL)
{
str += "\\";
str += tok;
}
}
return true;
}
return false;
}
我得到錯誤抱怨CreateDirectory電話:
* 錯誤C2664: 'CreateDirectory':不能從轉換參數1 'const char '至'LPCTSTR'
在線搜索,似乎我需要一些配置配給我的VC2008項目來解決這個問題。任何人都可以告訴我在哪裏以及如何?
+1,十分鐘沒有回答,所以我寫了一個你打敗了我。 –