[gtk-server] Re: Formatting floats (Was: gtk-server Digest V5 #3)

  • From: Peter van Eerten <administrator@xxxxxxxxxxxxxx>
  • To: gtk-server@xxxxxxxxxxxxx
  • Date: Fri, 05 Sep 2008 17:20:18 +0200

Reading the GLib docs:

http://library.gnome.org/devel/glib/stable/glib-String-Utility-Functions.html#g-snprintf

The 'g_snprintf' function and friends are very similar to the default libc functions, so why not give it a shot with GLIB? This is more portable also. Then it would look like:

gtk_server_define g_sprintf NONE NONE 3 WIDGET STRING DOUBLE

or

gtk_server_define g_snprintf NONE NONE 4 WIDGET INT STRING DOUBLE


On my Linux system:

peter@host:~$ gtk-server -stdin
gtk_server_define g_sprintf NONE NONE 3 WIDGET STRING DOUBLE
ok
gtk_server_opaque
7301168
g_sprintf 7301168 "%.2f" 1.234
ok
gtk_server_define g_printf NONE NONE 2 STRING WIDGET
ok
g_printf "%s\n" 7301168
1.23
ok

Please let me know if it works!

Regards
Peter

Quoting Erik Winkels <euqirea@xxxxxxxxx>:

Date: Fri, 05 Sep 2008 16:41:49 +0200
From: Peter van Eerten <administrator@xxxxxxxxxxxxxx>
Subject: [gtk-server] Re: List Activity

I have the same issue on my 64bit system. Can you please send me the output of the following:

echo "gtk_server_ffi" | gtk-server -stdin

FFI

echo "gtk_server_version" | gtk-server -stdin

2.2 build 7

uname -a

Windows XP Professional SP2 ;-)

I'm also using CLISP 2.45.

While I'm a Unix man by heart I'm actually targetting the application I'm writing at Windows (it will be a utility for a game I'm playing[1]) since the target audience is mainly using that platform.

I should have been more clear about that, sorry :-( Would it still be worth it to try the sprintf / printf solution you posted on the Windows platform?


Erik



--
http://www.gtk-server.org


Other related posts: