Re: [gtkmm] Glib::ustring -> int
- From: Christian Meyer <chrisime uni de>
- To: "Benjamin A. Cooper" <bacooper bacwater net>
- Cc: gtkmm-list gnome org
- Subject: Re: [gtkmm] Glib::ustring -> int
- Date: 04 Sep 2002 10:56:02 +0200
hi!
Am Mit, 2002-09-04 um 08.46 schrieb Benjamin A. Cooper:
> This may be a dumb question, but I am new to C++ and to gtkmm, as well
> as GTK+ in general.
>
> I have a Glib::ustring (returned from one of the widgets) I want to
> convert it to an integer for use elsewhere in my program.
>
> I tried the standard C function "atoi" but it does not work, I get the
> following error:
> cannot convert `Glib::ustring' to `const char*' for argument `
> 1' to `long int atol(const char*)'
>
> How do I get an int from the string (and a float as well)?
Try that:
Glib::ustring str;
str = "123";
locale_from_utf8 (str);
const char *c = str.c_str();
atol(c);
cout << str; // DEBUG
Greetings,
Christian
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]