simtiers
Messages postés207Date d'inscriptionjeudi 3 avril 2003StatutMembreDernière intervention 2 novembre 2006
-
21 févr. 2005 à 16:05
simtiers
Messages postés207Date d'inscriptionjeudi 3 avril 2003StatutMembreDernière intervention 2 novembre 2006
-
21 févr. 2005 à 20:43
Salut !
Je suis en train de faire un mini lecteur avec FMOD, sous Windows.
Dans ma classe CLecteur, interface
avec FMOD, je récupère les tags avec FSOUND_Stream_GetTagField, masi
j'ai une erreur 0x0005 qui apparait (violation d'accés)
strncpy( Infos->Commentaires, (char*)Val_Champ, len );
}
return true:
}
La structure d'infos :
struct INFORMATIONS_PISTE
{
char Album[50];
char Artiste[50];
char Titre[50];
char Commentaires[100];
char Annee[5];
char Piste[5];
char Duree[10];
};
J'ai vérifié, le void* Val_Champ renvoie une chaine de caractère
(toujours), mais je ne peux pas utiliser directement char* Val_Champ,
je ne sais pas comment faire
Merci de répondre !
A voir également:
Un programme essaie d'accéder aux informations d'adresse de courrier
simtiers
Messages postés207Date d'inscriptionjeudi 3 avril 2003StatutMembreDernière intervention 2 novembre 2006 21 févr. 2005 à 20:06
J'ai essayé de faire un cast; mais j'obtiens toujours la même erreur, en faisant comme ça :
char *Nom_Champ;
char *Val_Champ;
int type_tag = 0;
int len = 0;
memset( &Infos, 0, sizeof(INFORMATIONS_PISTE) );
for( int i=0; i<NbChamps; i++ )
{
FSOUND_Stream_GetTagField( Son, i, &type_tag, &Nom_Champ, (void**)&Val_Champ, &len );
...
}
...
Il ne faut pas allouer la memoire, voici le contenu de l'aide la fonction :
signed char F_API
FSOUND_Stream_GetTagField( FSOUND_STREAM
*stream, int num, int
*type, char **name, void
**value, int *length );
Parameters
stream,
The stream to get the tag field from.,
----
num,
The number of the tag field to retrieve.,
----
type,
Pointer to a variable that will receive the type of the tag field that was
retrieved. See FSOUND_TAGFIELD_TYPE.,
----
name,
Pointer to a variable that will receive the name of the tag field as a
null-terminated ASCII string.,
----
value,
Pointer to a variable that will receive a pointer to the tag field
data.,
----
length,
Pointer to a variable that will receive the length of the tag field
data.
Do not attempt to modify or free any pointers returned by this function
If this function returns successfully, "value" will contain a pointer to a piece
of tag-field-specific data - do not assume it will always point to a
null-terminated ASCII string.