Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Tema1.cpp : This file contains the 'main' function. Program execution begins and ends there.
- //
- #include <iostream>
- #include <Windows.h>
- #include <cstring>
- #include <string.h>
- using namespace std;
- void parcurgere(char* director) {
- cout << "We are in " << director << endl;
- WIN32_FIND_DATA find_data;
- HANDLE hDir = FindFirstFile(director, &find_data);
- director[strlen(director) - 1] = '\0';
- while (FindNextFile(hDir, &find_data)) {
- if ((find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0 && strcmp(find_data.cFileName,"..")!=0)
- {
- cout << find_data.cFileName<<endl;
- char* next_path = new char(1000);
- //cout << director << endl;
- strcpy(next_path,director);
- //cout << next_path;
- strcat(next_path,find_data.cFileName);
- strcat(next_path,"\\*");
- //cout << next_path << endl;
- //strcpy_s(path, strcat(strcat(director, "\\"), find_data.cFileName));
- //cout << find_data.cFileName<<endl;
- parcurgere(next_path);
- }
- }
- }
- int main(int argc, char*argv[])
- {
- char DirectoryName[1000];
- strcpy_s(DirectoryName, argv[1]);
- strcat_s(DirectoryName, "\\*");
- parcurgere(DirectoryName);
- }
- // Run program: Ctrl + F5 or Debug > Start Without Debugging menu
- // Debug program: F5 or Debug > Start Debugging menu
- // Tips for Getting Started:
- // 1. Use the Solution Explorer window to add/manage files
- // 2. Use the Team Explorer window to connect to source control
- // 3. Use the Output window to see build output and other messages
- // 4. Use the Error List window to view errors
- // 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
- // 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement