我想在一目录下查找*.bmp文件,写了如下代码,编译有错误,请高手指点~~
主要代码如下
[code]
HANDLE hFile = NULL;
WIN32_FIND_DATAA lpFindFileData;
// BOOL bContinue = FALSE;
int i = 0;
for(i=0;i<50;i++)
wcscpy(cFileList,_T(""));
i = 0;
hFile = FindFirstFile(L"*.bmp",&lpFindFileData);
while (1)
{
strcpy(cFileList,&lpFindFileData.cFileName);
if (FindNextFile(m_handle,&lpFindFileData)==0)
{
FindClose(hFile);
break;
}
i++;
nFileTotalCount++;
}
编译错误是:
Deleting intermediate files and output files for project 'Test - Win32 (WCE ARMV4I) Debug'.
--------------------Configuration: Test - Win32 (WCE ARMV4I) Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
CeFileFind.cpp
Test.cpp
TestDlg.cpp
C:\Documents and Settings\hw001\桌面\Test\TestDlg.cpp(131) : error C2664: 'FindFirstFileW' : cannot convert parameter 2 from 'struct _WIN32_FIND_DATAA *' to 'struct _WIN32_FIND_DATAW *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Documents and Settings\hw001\桌面\Test\TestDlg.cpp(135) : error C2664: 'strcpy' : cannot convert parameter 1 from 'unsigned short [8]' to 'char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Documents and Settings\hw001\桌面\Test\TestDlg.cpp(136) : error C2065: 'm_handle' : undeclared identifier
VOIMAGE.CPP
VOString.cpp
Generating Code...
Error executing clarm.exe.
Creating browse info file...
Test.exe - 3 error(s), 0 warning(s)
使用WIN32_FIND_DATA,而不是WIN32_FIND_DATAA
EVC下要使用Unicode
字符串操作要使用wcs前缀的函数,不是str前缀的