strcat() for formatted strings

前端 未结 6 1438
予麋鹿
予麋鹿 2021-02-20 05:37

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

6条回答
  •  长情又很酷
    2021-02-20 06:01

    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.

提交回复
热议问题