[Qt Linux] Aide pour une erreur HELP

ribery91720 Messages postés 17 Date d'inscription dimanche 6 janvier 2008 Statut Membre Dernière intervention 27 mars 2009 - 27 mars 2009 à 09:38
Pistol_Pete Messages postés 1053 Date d'inscription samedi 2 octobre 2004 Statut Membre Dernière intervention 9 juillet 2013 - 27 mars 2009 à 09:53
Grace à vous j'ai trouvé.


Maintenant j'ai une nouvelle erreur dans une autre fonction.

Voila l'erreur que j'obtiens :

classwizard.cpp:770: erreur: passing ‘const std::string’ as ‘this’ argument of ‘std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’ discards qualifiers

Et le code correspondant est le suivant :

766voidwriteString(conststringbuff)
767{
768
769// On limite la chaine à 10 caractères
770buff=buff.substr(0,10);
771
772// On copie la chaine dans le buffer
773//strncpy(&SendBuff[5], buff.c_str(), buff.size());
774copy(buff.begin(),buff.end(),&SendBuff[5]);
775// On peut aussi copier avec std::copy(buff.begin(), buff.end(), &SendBuff[5]);
776
777
778SendBuff[0]=0x80;//CLA
779SendBuff[1]=0xD2;//INS
780SendBuff[2]=0x00;//P1
781SendBuff[3]=0x00;//P2
782SendBuff[4]=buff.size();//P3
783
784dwSend=SendBuff[4]+0x05;
785dwRecv=2;
786
787ExchangeData(SendBuff,dwSend,RecvBuff,&dwRecv);// Envoi à la carte
788
789}


Voila

Pouvez vous m'aider à trouver cette erreur

Merci à tous

1 réponse

Pistol_Pete Messages postés 1053 Date d'inscription samedi 2 octobre 2004 Statut Membre Dernière intervention 9 juillet 2013 7
27 mars 2009 à 09:53
Salut
Ton paramètre buff est déclarée en const (constante) donc tu n'as pas le droit de le modifier et c'est ce que tu fait à la ligne 770.
A+

____________________________________________________________________________
Mon site internet :  
http://ImAnalyse.free.fr
0
Rejoignez-nous