Bonjour,
Je suis débutant en C++ depuis environ 1 an ( à petit régime...).
Je cherche a faire un code qui analyse récursivement un répertoire donné et écrit dans un fichier texte le nom et le chemin d'accès d'un fichier selon son extension (.inf ici). C'est cela que je n'arrive pas a faire.
J'en ai besoin pour convertir des fichiers (que je recherche a lister) vers une autre extension (.bgl) selon avec une ligne de commande déja établi dans windows.
Pour le moment, j'ai érit ca : (je sais il faut pas utiliser using namespace std...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74 // BGL Creator with .inf from ORTHO4XP.cpp : Ce fichier contient la fonction 'main'. L'exécution du programme commence et se termine à cet endroit. // #include "pch.h" #include <iostream> #include <string> #include <stdio.h> #include <fstream> using namespace std; string acessPath; string resamplePath; string recoverAcessPath() { cout << "Folder to scan : "; string acessPathLoc; cin >> acessPathLoc; return acessPathLoc; } string recoverP3DSDKPath() { cout << "P3D SDK resample.exe path : "; string SDKPathLoc; cin >> SDKPathLoc; return SDKPathLoc; } void launchProcess(string acessPath, string fileName) { system(("cd " + resamplePath).c_str()); system(("resample " + acessPath + " " + fileName).c_str()); } int main() { //Demander le chemin a scanner acessPath = recoverAcessPath(); resamplePath = recoverP3DSDKPath(); //Scanner le répertoire ofstream file("\log.txt"); if (file) //On teste si tout est OK { //Tout est OK, on peut utiliser le fichier } else { cout << "ERROR 418 : Impossible to open or create log.txt file." << endl; } //Lancer le processus de transformation ( va surement changer... ) int i = 0; if (i != fileNb) { //filename = ; launchProcess(acessPath, fileName); i++; } else { cout << "Process finished ! Moving files..." << endl; } //Récupérer tous les .bgl et les commer dans un dossier a la racine du programme return 0; }
Merci d'avance pour votre aide.
Cordialement.
Partager