wxDev.fr, le portail francophone consacré à wxWidgets ! ( The french portal for wxWidgets )  
Esp. membre
Recheche rapide



Recherche avancée
Statistiques
Membres inscrits :2359

Membres en ligne : 0
Invités en ligne : 3
Pub hébergeur
Pourquoi cette pub ?

Valid XHTML 1.0 Transitional

Valid CSS2

Menu forum (navigation):
Pages: 1  
 
Accueil » Accueil forums » Utilisation générale wxWidgets
» Aide sur SetChar
Conversation (Résolue) : Aide sur SetChar
13-09-2013 14:12:44  Aide sur SetChar #1
Ded (Membre)
Lieu: Grenoble (38)
Inscrit le : 09-09-2013
Messages: 41
Snippets: 0
Tutoriels: 0
Hors ligne
j'essaie de remplacer le dernier caractère d'une chaîne par " " et j'y arrive pas.

Code:

 
wxNew_FileName.SetChar(wxNew_FileName.Len() - 1,wxT(" "));
 

donne une erreur de compile :

Code:

 
-------------- Build: Release in p-09-12-16-45 (compiler: GNU GCC Compiler)---------------
 
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wno-attributes -Wall  -O2    -ID:\CPP\wxBook\wxWidgets-2.9.5\include -ID:\CPP\wxBook\wxWidgets-2.9.5\contrib\include -ID:\CPP\wxBook\wxWidgets-2.9.5\lib\gcc_lib\mswu -ID:\CPP\wxBook\wxWidgets-2.9.5\lib\gcc_lib\mswu -ID:\CPP\wxBook\wxWidgets-2.9.5\include  -c D:\wxWidgetsApp\p-09-12-16-45\p_09_12_16_45Main.cpp -o obj\Release\p_09_12_16_45Main.o
D:\wxWidgetsApp\p-09-12-16-45\p_09_12_16_45Main.cpp: In member function 'void MyFrame::OnGo(wxCommandEvent&)':
D:\wxWidgetsApp\p-09-12-16-45\p_09_12_16_45Main.cpp:247:44: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
D:\wxWidgetsApp\p-09-12-16-45\p_09_12_16_45Main.cpp: In function 'wxString Clean_FileName(wxString, wxString)':
D:\wxWidgetsApp\p-09-12-16-45\p_09_12_16_45Main.cpp:364:59: error: conversion from 'const wchar_t [2]' to 'wxUniChar' is ambiguous
D:\wxWidgetsApp\p-09-12-16-45\p_09_12_16_45Main.cpp:364:59: note: candidates are:
In file included from D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/strvararg.h:23:0,
                 from D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/string.h:51,
                 from D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/memory.h:16,
                 from D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/object.h:20,
                 from D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/wx.h:16,
                 from D:\wxWidgetsApp\p-09-12-16-45\p_09_12_16_45Main.cpp:30:
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:40:5: note: wxUniChar::wxUniChar(wchar_t) <near match>
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:40:5: note:   no known conversion for argument 1 from 'const wchar_t [2]' to 'wchar_t'
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:40:5: note: wxUniChar::wxUniChar(long long unsigned int) <near match>
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:40:5: note:   no known conversion for argument 1 from 'const wchar_t [2]' to 'long long unsigned int'
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:40:5: note: wxUniChar::wxUniChar(long long int) <near match>
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:40:5: note:   no known conversion for argument 1 from 'const wchar_t [2]' to 'long long int'
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:40:5: note: wxUniChar::wxUniChar(long unsigned int) <near match>
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:40:5: note:   no known conversion for argument 1 from 'const wchar_t [2]' to 'long unsigned int'
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:40:5: note: wxUniChar::wxUniChar(long int) <near match>
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:40:5: note:   no known conversion for argument 1 from 'const wchar_t [2]' to 'long int'
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:40:5: note: wxUniChar::wxUniChar(unsigned int) <near match>
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:40:5: note:   no known conversion for argument 1 from 'const wchar_t [2]' to 'unsigned int'
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:40:5: note: wxUniChar::wxUniChar(int) <near match>
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:40:5: note:   no known conversion for argument 1 from 'const wchar_t [2]' to 'int'
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:40:5: note: wxUniChar::wxUniChar(short unsigned int) <near match>
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:40:5: note:   no known conversion for argument 1 from 'const wchar_t [2]' to 'short unsigned int'
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:40:5: note: wxUniChar::wxUniChar(short int) <near match>
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:40:5: note:   no known conversion for argument 1 from 'const wchar_t [2]' to 'short int'
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:36:5: note: wxUniChar::wxUniChar(unsigned char) <near match>
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:36:5: note:   no known conversion for argument 1 from 'const wchar_t [2]' to 'unsigned char'
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:35:5: note: wxUniChar::wxUniChar(char) <near match>
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/unichar.h:35:5: note:   no known conversion for argument 1 from 'const wchar_t [2]' to 'char'
In file included from D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/memory.h:16:0,
                 from D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/object.h:20,
                 from D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/wx.h:16,
                 from D:\wxWidgetsApp\p-09-12-16-45\p_09_12_16_45Main.cpp:30:
D:\CPP\wxBook\wxWidgets-2.9.5\include/wx/string.h:1571:10: error:   initializing argument 2 of 'void wxString::SetChar(size_t, wxUniChar)'
Process terminated with status 1 (0 minutes, 2 seconds)
2 errors, 1 warnings (0 minutes, 2 seconds)
 

je suis nouveau en C++ et en wxWidgets !!
----------

Code:

 
  wxChar wxc = wxT(' ');
  wxNew_FileName.SetChar(wxNew_FileName.Len() - 1,wxc);
 

marche très bien.

Dernière modification par Ded (13-09-2013 15:07:10)


Code::Blocks 13.12 on Windows 7 (build 7601 service pack 1 64 bit edition).
GNU GCC version 4.7.1 -std=c++11 Make version 3.82.
wxWidgets 3.0.0 compiled shared=0 monolithic=1 unicode=1 build=release.
Menu forum (navigation):
Pages: 1  
 
Accueil » Accueil forums » Utilisation générale wxWidgets
» Aide sur SetChar