#include <stdlib.h>#include <iostream>#include "windows.h"int main(int argc, char *argv[]){ setlocale(LC_ALL,""); std::cout<<argc<<std::endl; std::cout<<argv<<std::endl; WIN32_FIND_DATA FindFileData; HANDLE hf; hf=FindFirstFile(L"E:\\*", &FindFileData); if (hf!=INVALID_HANDLE_VALUE) { do { std:: cout << FindFileData.cFileName << " "<<FindFileData.nFileSizeLow<<std::endl; } while (FindNextFile(hf,&FindFileData)!=0); FindClose(hf); } return 0;}
C++ (Qt)std::wcout << FindFileData.cFileName << " "<<FindFileData.nFileSizeLow<<std::endl;
const short STRING_LENGTH = 3;std::wstring fileName(FindFileData.cFileName);std::wcout << fileName.substr(0, STRING_LENGTH) << " "<<FindFileData.nFileSizeLow<<std::endl;
C++ (Qt)#include "windows.h"#include <tchar.h> int main(){ WIN32_FIND_DATA FindFileData; HANDLE hf; hf = FindFirstFile(TEXT("C:\\*"), &FindFileData); if(hf != INVALID_HANDLE_VALUE) { do { //limiting the output to 10 characters _tprintf(TEXT("%.10ls\t%d\n"), FindFileData.cFileName, FindFileData.nFileSizeLow); } while(FindNextFile(hf,&FindFileData) != 0); FindClose(hf); } return 0;}