Error C2679: binary '='
Résolu/Fermé
odin13
Messages postés
41
Date d'inscription
vendredi 13 avril 2007
Statut
Membre
Dernière intervention
16 mai 2007
-
10 mai 2007 à 13:55
odin13 Messages postés 41 Date d'inscription vendredi 13 avril 2007 Statut Membre Dernière intervention 16 mai 2007 - 10 mai 2007 à 14:46
odin13 Messages postés 41 Date d'inscription vendredi 13 avril 2007 Statut Membre Dernière intervention 16 mai 2007 - 10 mai 2007 à 14:46
Comment résoudre l'erreur:
E:\OID\FichierINIOid.cpp(49) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no acceptable conversion)
l'erreur ce trouve la mais je comprends pas pourquoi:
int CFichierINIOid::GetCodeApplication(int numero)
{
long application;
application = GetString("numeroTRAME","APPLICATION","0");
return application;
}
Merciiiiiiiiiiiiiiiiii :-)
E:\OID\FichierINIOid.cpp(49) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no acceptable conversion)
l'erreur ce trouve la mais je comprends pas pourquoi:
int CFichierINIOid::GetCodeApplication(int numero)
{
long application;
application = GetString("numeroTRAME","APPLICATION","0");
return application;
}
Merciiiiiiiiiiiiiiiiii :-)
3 réponses
Char Snipeur
Messages postés
9813
Date d'inscription
vendredi 23 avril 2004
Statut
Contributeur
Dernière intervention
3 octobre 2023
1 298
10 mai 2007 à 14:06
10 mai 2007 à 14:06
il te dit que tu ne peut convertir un string en entier.
donc l'opération d'affectation n'a pas de sens.
D'après le message du compilo(je ne connai pas cette fonction), GetString renvoie un string. Il faut lui dire comment passer de "papa maman sont dans la piscine" à (long)2315
voi du coté de atoi()
donc l'opération d'affectation n'a pas de sens.
D'après le message du compilo(je ne connai pas cette fonction), GetString renvoie un string. Il faut lui dire comment passer de "papa maman sont dans la piscine" à (long)2315
voi du coté de atoi()
odin13
Messages postés
41
Date d'inscription
vendredi 13 avril 2007
Statut
Membre
Dernière intervention
16 mai 2007
10 mai 2007 à 14:20
10 mai 2007 à 14:20
mais du cou, ej dois remplacer quoi dans ma fonction:
{
long application;
application = GetString("numeroTRAME","APPLICATION","0");
return application;
}
Jsusi noyé la!! lol
{
long application;
application = GetString("numeroTRAME","APPLICATION","0");
return application;
}
Jsusi noyé la!! lol
Char Snipeur
Messages postés
9813
Date d'inscription
vendredi 23 avril 2004
Statut
Contributeur
Dernière intervention
3 octobre 2023
1 298
10 mai 2007 à 14:38
10 mai 2007 à 14:38
at(0) te renvoi le premier caractère de la chaine.
ensuite c'est converti implicitement de char à int (ou long)
Tu n'est pas clair.
je pense que ce que tu cherche à faire c'est :
ensuite c'est converti implicitement de char à int (ou long)
Tu n'est pas clair.
je pense que ce que tu cherche à faire c'est :
int CFichierINIOid::GetCodeApplication(int numero) { long application; application = atoi(GetString("numeroTRAME","APPLICATION","0")); return application; }
odin13
Messages postés
41
Date d'inscription
vendredi 13 avril 2007
Statut
Membre
Dernière intervention
16 mai 2007
10 mai 2007 à 14:46
10 mai 2007 à 14:46
Jte remercie !!!!! ca marche!!!!!!
C'est sympa de ta part d'avoir répondu!! :-)
C'est sympa de ta part d'avoir répondu!! :-)
10 mai 2007 à 14:32
int CFichierINIOid::GetCodeApplication(int numero)
{
string application;
string
application = GetString("TRAME","APPLICATION","0");
return application.at(0);
}
apparement ca marche! lol
Dans: application = GetString("TRAME","APPLICATION","0");
comment je fais pour définir une chaine de caractére?
Car en fait dans mon fichier.INI l'utilisateur peut rentrer autant de paramétres qu'il le souhaite (jc pas si je suis trsé clair) lol