error C2664: “FindFirstFileW”: 不能将参数 1 从“LPSTR”转换为“LPCWSTR”
与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换
error C2664: “strcmp”: 不能将参数 1 从“WCHAR [260]”转换为“const char *”
与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换
error C2664: “strcmp”: 不能将参数 1 从“WCHAR [260]”转换为“const char *”
error C2664: “strcat”: 不能将参数 2 从“WCHAR [260]”转换为“const char *”
与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换#include "stdafx.h"
#include "Windows.h"
#include "stdio.h"void Find(LPSTR path){
WIN32_FIND_DATA fs={0}; CHAR buf[512]={0};
strcpy(buf,path); strcat(path,"/*.*"); HANDLE hFind=FindFirstFile(path,&fs);
BOOL goFind=TRUE; while(goFind){
if(fs.dwFileAttributes==FILE_ATTRIBUTE_ARCHIVE)
{
printf("%s\n",fs.cFileName);
Sleep(1000);
}else{
if(strcmp(fs.cFileName,".")&&strcmp(fs.cFileName,"..")){
CHAR buff[512]={0};
strcat(buff,buf);
printf("[%s]\n",fs.cFileName);
Sleep(1000);
strcat(buff,"/");
strcat(buff,fs.cFileName);
Find(buff);
printf("-----------\n");
}
}
goFind=FindNextFile(hFind,&fs);
}
//free(nPath);
FindClose(hFind);
return;
}
int main(int argc, char* argv[])
{
CHAR path[512]="E:/win32/dll_lib";
Find(path);
return 0;
}
把CHAR buf[512]={0};改成WCHAR buf[512]={0};对了发错版块了