I\'m building a string piece by piece in my program and am currently using a mix of strcat() when I\'m adding a simple string onto the end, but when im adding a formatted string
What the preferred method is, depends on what you are willing to use. Instead of doing all those manual (and potentially dangerous) string operations, I would use the GString
data structure from GLib or GLib's g_strdup_print
function. For your problem, GString
provides the g_string_append_printf function.