char * stft (const char *fmt, ...) {
va_list items;
char *out;
int magic = 0; // <-- here magic?
va_start (items, fmt);
vsprintf (out, fmt, items);
va_end (items);
return out;
}
Use like:
char *str = stft ("%s-%s %s", a, b, c);
This is working solution?
if delete unused "magic" variable - I have Segmentation fault after return string.
What doing wrong?
$ gcc --version
gcc (Debian 4.4.5-8) 4.4.5
$ uname -a
Linux deep-station (squeeze) 2.6.32-5-686 #1 SMP Fri May 10 08:33:48 UTC 2013 i686 GNU/Linux
No comments:
Post a Comment