Re: Glib::ustring
- From: Robert Pearce <rob bdt-home demon co uk>
- To: gtkmm-list gnome org
- Subject: Re: Glib::ustring
- Date: Thu, 6 Mar 2008 09:00:44 +0000
On Wed, 5 Mar 2008 21:06:45 -0600
"Jorge Luis Vidales Valladares" <jorgevidales gmail com> wrote:
> char* szMessage;
>
>
> szMessage= m_Entry1.get_text(); ///here is the error "cannot
> convert `Glib::ustring' to `char' in assignment"..
>
Indeed. Because the get_text() method returns a Glib::ustring, which is
absolutely not just a char*. You need to look up the documentation on
ustring - it has a method for extracting a char* from it. I think it's
called c_str() but I may be getting confused with std::string or
Borland's VCL AnsiString and I don't have a web browser on this box to
check the GTKmm docs.
Incidentally, it works the other way, passing a char* when a
Glib::ustring is wanted, because Glib::ustring provides a constructor
that takes a char* argument. The compiler knows that:
MethodThatTakesUString ( "hello" );
is a short-hand for:
MethodThatTakesUString ( Glib::ustring("hello") );
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]