Error C2679: binary '='

Résolu
odin13 Messages postés 41 Statut Membre -  
odin13 Messages postés 41 Statut Membre -
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 :-)
Configuration: Windows 2000
Internet Explorer 6.0

3 réponses

  1. Char Snipeur Messages postés 10112 Date d'inscription   Statut Contributeur Dernière intervention   1 331
     
    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()
    0
    1. odin13 Messages postés 41 Statut Membre
       
      voila j'ai fais ce changement:
      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
      0
  2. odin13 Messages postés 41 Statut Membre
     
    mais du cou, ej dois remplacer quoi dans ma fonction:
    {
    long application;
    application = GetString("numeroTRAME","APPLICATION","0");
    return application;
    }

    Jsusi noyé la!! lol
    0
  3. Char Snipeur Messages postés 10112 Date d'inscription   Statut Contributeur Dernière intervention   1 331
     
    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 :
    int CFichierINIOid::GetCodeApplication(int numero)
    {
    long application;
    application = atoi(GetString("numeroTRAME","APPLICATION","0"));
    return application;
    }
    
    0
    1. odin13 Messages postés 41 Statut Membre
       
      Jte remercie !!!!! ca marche!!!!!!
      C'est sympa de ta part d'avoir répondu!! :-)
      0