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
| void LECTURE (FILE *fp,int longueur,struct TAG_mp3 *p_mp3){
char nom_ref[5];
char res_ref[50];
char flag[3];
int taille_ref;
int taille;
taille = 0;
do {
//nom de la référence
fread(nom_ref,sizeof(char),4,fp);
nom_ref[4] ='\0';
//taille de la référence
fread(&taille_ref,sizeof(int),1,fp);
taille_ref = Swap32(taille_ref);
//3 flags
fread(flag,sizeof(char),3,fp);
//contenu de la référence
fread(res_ref,sizeof(char),taille_ref-1,fp);
res_ref[taille_ref-1]='\0';
taille = (taille + 11 + taille_ref - 1);
if (strncmp(nom_ref,"TIT2",4)==0)
strcpy(p_mp3->titre, res_ref);
if (strncmp(nom_ref,"TLEN",4)==0)
strcpy(p_mp3->duree, res_ref);
if(strncmp(nom_ref,"TRCK",4)==0)
strcpy(p_mp3->track, res_ref);
if(strncmp(nom_ref,"TPE1",4)==0)
strcpy(p_mp3->artiste, res_ref);
if(strncmp(nom_ref,"TALB",4)==0)
strcpy(p_mp3->album, res_ref);
}
while (taille <= longueur);
} |
Partager