Soy novato en c++.. y no se como se unen las cadenas. Este es mi codigo:
Código c++:
El error que me tira, es:Ver original
#include <iostream> #include <string> #include <windows.h> using namespace std; void directorioDatos(string dir, string formato){ WIN32_FIND_DATA wFindData; HANDLE hFile; BOOL NextFile = TRUE; hFile = FindFirstFile( "C:\\Windows\\"+(dir)+"*."+(formato), &wFindData ); // hFile = FindFirstFile( "C:\\Windows\\*.*", &wFindData ); if( hFile != INVALID_HANDLE_VALUE ) { while( NextFile ) { if( wFindData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY ) { // directorioDatos(wFindData.cFileName+"\\"); cout<<"CARPETA: "<<wFindData.cFileName<<"\n"; }else{ cout<<wFindData.cFileName<<"\n"; } NextFile = FindNextFile( hFile, &wFindData ); } } else { MessageBox( 0, "No se encontraron archivos", "Error!!!", MB_OK | MB_ICONERROR ); } CloseHandle( hFile ); } int main(int argc, char *argv[]) { directorioDatos("","*"); return 0; }
Cita:
GraciasC:\Users\pato\zinjai\sin_titulo.cpp:14: error: cannot convert `std::basic_string<char, std::char_traits<char>, std::allocator<char> >' to `const CHAR*' for argument `1' to `void* FindFirstFileA(const CHAR*, _WIN32_FIND_DATAA*)'
Salu2
