Re: General advice on type casting
- From: "Nils O. Selåsdal" <NOS@xxxxxxx>
- Date: Thu, 31 Aug 2006 11:43:04 +0200
Olivier wrote:
Dear all,
Here is a sample of my code:
----------------------------------------------
void message_is(gchar *ff, int d, gchar *o){
gchar *texte = NULL;
texte = g_malloc(256);
g_snprintf(texte, 256, ff, d, o);
Sol_print_infos(texte); /* g_free(texte) */;
}
void message_sd(gchar *ff, gchar *d, double o){
gchar *texte = NULL;
texte = g_malloc(256);
g_snprintf(texte, 256, ff, d, o);
Sol_print_infos(texte); /* g_free(texte) */;
}
void message_iii(gchar *ff, int d, int o, int t){
gchar *texte = NULL;
texte = g_malloc(256);
g_snprintf(texte, 256, ff, d, o ,t);
Sol_print_infos(texte); /* g_free(texte) */;
}
----------------------------------------------
where you can guess that Sol_print_infos is the
guy that does the actual printing with style
and all.
I haven't been able to put all of them in one
piece of code. (And I have more !!). Efficiency
in terms of time is faily irrelevant at this
level.
Thanks in advance !
Amities,
Olivier
void message(char *fmt,...)
{
char *texte;
va_list ap;
texte = malloc(256);
if(texte != NULL) {
va_start(ap,fmt);
vsnprintf(gtexte, 256, fmt, ap);
va_end(ap);
Sol_print_infos(texte);
free(texte);
}
}
.
- Follow-Ups:
- Re: General advice on type casting
- From: Olivier
- Re: General advice on type casting
- References:
- General advice on type casting
- From: Olivier
- General advice on type casting
- Prev by Date: Info
- Next by Date: Re: Info
- Previous by thread: General advice on type casting
- Next by thread: Re: General advice on type casting
- Index(es):
Relevant Pages
|