Re: How to change float to char
- From: Skip Montanaro <skip pobox com>
- To: engenharia3 maqplas com br
- Cc: gtk-list gnome org
- Subject: Re: How to change float to char
- Date: Fri, 13 Jul 2001 16:01:47 -0500
Flavio> I need to print float numbers in a gtk label and this widget
Flavio> only accept gchar in your text parameter, I want to know if
Flavio> exists some type of routine that changes float number in format
Flavio> a.bcde to char format "a.bcde".
Check out g_snprintf in the glib reference manual (section: String Utility
Functions). I believe you call it pretty much like you would sprintf, with
the added safety feature that you provide the length of the output buffer so
it doesn't scribble past the end of it:
g_snprintf(buf, len_buf-1, "%6.4f", myfloat);
--
Skip Montanaro (skip pobox com)
(847)971-7098
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]