Re: label with format string
- From: "Nix N. Nix" <nix achilles go-nix ca>
- To: Johannes WeiÃl <jargon hurg org>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: label with format string
- Date: Tue, 9 Sep 2003 11:46:15 -0400 (EDT)
Here's another version, using glib stuff alone:
/* I work with the 1.2.x version of g* */
void lblprintf (GtkWidget *lbl, char *pszFormat, ...)
{
const char *pszFmt = pszFormat ;
char *pszMsg = NULL ;
int ic = 0 ;
va_start (va, pszFormat) ;
pszMsg = malloc (ic = g_printf_string_upper_bound (pszFmt, va)) ;
g_vsnprintf (pszMsg, ic, pszFmt, va) ;
va_end (va) ;
gtk_label_set_text (GTK_LABEL (lbl), pszMsg) ;
free (pszMsg) ;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]