#include "stdafx.h" #include <windows.h> #include <stdio.h> #include <iostream> #include <dos.h> using namespace std; class Dir { public: char* cat; Dir() { cout << "(C:/*)\n"; cat = new char[50]; cin >> cat; } void virtual ShowFiles() { } }; class Inside : public Dir { public: void virtual ShowFiles() { HANDLE hSearch; WIN32_FIND_DATA pFileData; hSearch = FindFirstFile(cat,&pFileData); if (hSearch != INVALID_HANDLE_VALUE) do { // if ((pFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) cout << pFileData.cFileName << "\n"; } while (FindNextFile(hSearch,&pFileData)); FindClose(hSearch); } }; int main() { Dir *obj1[2]; obj1[1] = new Inside; obj1[1]->ShowFiles(); return 0; }
所以我有一个程序,我需要用动态char cat显示目录中的所有文件,但它可以在Borland C中编译,但在Visual Studio 15 Resharper中它不起作用.严重性代码描述项目文件行
“char *”类型的错误(活动)参数与“LPCWSTR”类型的参数不兼容