Creating C formatted strings (not printing them)

前端 未结 7 1046
广开言路
广开言路 2020-12-04 12:07

I have a function that accepts a string, that is:

void log_out(char *);

In calling it, I need to create a formatted string on the fly like:

7条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-04 12:18

    Don't use sprintf.
    It will overflow your String-Buffer and crash your Program.
    Always use snprintf

提交回复
热议问题