18 Jul
2013
18 Jul
'13
3:18 a.m.
2013/7/16 Arshdeep Singh <moduli16@...400...>:
I am facing one problem in that respect: Initializing a string,
gchar* id = g_sprintf( "obj%d", i ); is giving a runtime error. The same goes with g_snprintf( ..)
Any idea whats going wrong ?
Please read the documentation: https://developer.gnome.org/glib/2.28/glib-String-Utility-Functions.html#g-s...
You are trying to write the constant string pointed to by 'i' into a constant string.
You should use g_strdup_printf, or even better, Glib::ustring::compose and Glib::ustring::format instead: https://developer.gnome.org/glibmm/unstable/classGlib_1_1ustring.html#a18e12... https://developer.gnome.org/glibmm/unstable/classGlib_1_1ustring.html#ab107f...
Regards, Krzysztof