How to do this task: Before each file name (regular file) insert its number (1, 2, 3, etc.). The number is set in accordance with the order in which the FindFirstFile function, FindNextFile, returns results.
I could only do this:
#include <windows.h> #include <iostream> #include<tchar.h> using namespace std; //strcpy, strcat //_tcscpy,_tcscat int main() { DWORD dwError = 0; setlocale(LC_ALL, "rus"); WIN32_FIND_DATA find; HANDLE hFind = FindFirstFile(_T("C:\\test\\*"), &find); { if (INVALID_HANDLE_VALUE == hFind) { cout << "Каталог не найден!" << endl; system("pause"); return dwError; } do { if (!(find.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY) && !(find.dwFileAttributes == FILE_ATTRIBUTE_DEVICE)) _tprintf(_T("%s\n"), find.cFileName); } while (FindNextFile(hFind, &find) != NULL); dwError = GetLastError(); if (dwError == ERROR_NO_MORE_FILES) { FindClose(hFind); cout << "В каталоге нет файлов!" << endl; system("pause"); return dwError; } }////нет проверки на успешность FindFirstFile FindClose(hFind); ////нет проверки на успешность FindClose cout << "Файлы выведены на экран" << endl; system("pause"); return 0; } And how to rename files do not understand