RE: Glib::ustring
- From: "Jorge Luis Vidales Valladares" <jorgevidales gmail com>
- To: "'Robert Pearce'" <rob bdt-home demon co uk>, <gtkmm-list gnome org>
- Subject: RE: Glib::ustring
- Date: Thu, 6 Mar 2008 11:01:57 -0600
Thanks for the int
I Look for the doc's and finally i came up with this that works
Glib::ustring str;
str = m_Entry1.get_text();
locale_from_utf8 (str);
const char *szMessage= str.c_str();
int nBytesSent = serial.SendData(szMessage, strlen(szMessage));
Thanks again
-----Original Message-----
From: gtkmm-list-bounces gnome org [mailto:gtkmm-list-bounces gnome org] On
Behalf Of Robert Pearce
Sent: Thursday, March 06, 2008 3:01 AM
To: gtkmm-list gnome org
Subject: Re: Glib::ustring
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") );
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.21.6/1315 - Release Date: 3/6/2008
9:07 AM
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.21.6/1315 - Release Date: 3/6/2008
9:07 AM
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]