FindFirstFile
函数以某种方式不接受我的wstring(也不是字符串)作为参数传递。C++ FindFirstFile无法将常量字符转换为basic_string
我得到一个编译错误
Cannot convert const char[9] to std::basic_string
#include "stdafx.h"
#include <string>
#include <iostream>
#include <stdio.h>
#include <Windows.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
wstring path = "C:\\*.dmp";
WIN32_FIND_DATA dataFile;
HANDLE hFind;
hFind = FindFirstFile (path.c_str(), &dataFile);
cout << "The name of the first found file is %s \n" dataFile.cFileName << endl;
FindClose hFind;
getchar();
return 0;
}
@Muteking这是另外一个我先回答,再看一看。 –
几乎完美的潘塔雷,但现在这个错误蔓延:语法错误';'在hFind标识符之前缺失。(在endl后) – Muteking
@Muteking您可能错过了包含其他内容,FindClose来自哪里?无论如何,这与你原来的问题无关。另一个错误,请另一个问题。我不是来帮助吸血鬼的。 –