Bonjour,

Pour commencer, je précise que je suis débutant en c++, donc j'ai du mal avec tout le lexique du c++ (classes, méthodes, fonctions etc...).

Petite précision aussi, je code avec CodeBlocks 20.03 sous Win10 x64.

Voici ce que j'ai codé:


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
vector<StructSings> tabSong;
 
int tailleTab = 0;
 
vector<string> arraySongs;
 
string path = "C:\\Users\\33645\\Desktop\\Formation C\\taglib2\\bin\\Musics\\";
 
string pathSong = "";
 
int i = 0;   
 
arraySongs = ReadFiles();
 
tailleTab = arraySongs.size() - 1;
 
 
 
for(i = 1; i <= tailleTab; i++)
 
    {
 
        pathSong = path + arraySongs[i];
 
        cout << pathSong << endl;
 
        TagLib::FileRef f(pathSong.c_str());
 
        tabSong.push_back(StructSings());
 
        tabSong[i].artist = f.tag()->artist();
 
        tabSong[i].song = f.tag()->title();
 
        tabSong[i].year = f.tag()->year();
 
        tabSong[i].comment = f.tag()->comment();
 
    }

Le programme plante à cette ligne "TagLib::FileRef f(pathSong.c_str());" quand je boucle une deuxième fois.



je suppose que je n'ai pas le droit d'utiliser "f" une deuxième fois...

mais du coup, je ne comprend pas comment automatiser.



P.S: j'utilise une bibliothèque taglib qui est utilisée pour jouer avec des fichiers musicaux.

merci d'avance pour votre aide.