当前位置:网站首页>Sprintf formatter abnormal exit problem
Sprintf formatter abnormal exit problem
2022-07-03 04:49:00 【*_ Look up at the starry sky_*】
Use sprintf Formatter exception
static char logfileBuf[1024] = {
0};
sprintf(logfileBuf, "<%d ms>[%s:%d %s] %s", time, __FILE__, __LINE__, __FUNCTION__, buf);
Format output directly to logfileBuf Abnormal exit of program
At first, I thought it would be logfileBuf The buffer is too small , It still exits abnormally after increasing
Debugging takes a long time to find a solution
char fileBuf[512] = {
0};
char lineBuf[100] = {
0};
char funcBuf[100] = {
0};
char timeBuf[100] = {
0};
sprintf(timeBuf, "<%lld ms>", time);
sprintf(fileBuf, "%s", __FILE__);
sprintf(lineBuf, "%d", __LINE__);
sprintf(funcBuf, "%s", __FUNCTION__);
sprintf(logfileBuf, "%s[%s:%s %s] %s", timeBuf, fileBuf, lineBuf, funcBuf, buf);
Format step by step first __FILE__、__LINE__ these , Finally, format it uniformly to logfileBuf.
边栏推荐
- 第十九届浙江省 I. Barbecue
- Career planning of counter attacking College Students
- 论文阅读_中文NLP_ELECTRA
- 逆袭大学生的职业规划
- M1 Pro install redis
- 有道云笔记
- The reason why the entity class in the database is changed into hump naming
- ZABBIX monitoring of lamp architecture (2): ZABBIX basic operation
- Market status and development prospect prediction of global SoC Test Platform Industry in 2022
- Learning practice: comprehensive application of cycle and branch structure (I)
猜你喜欢

Thesis reading_ ICD code_ MSMN

Valentine's day limited withdrawal guide: for one in 200 million of you

ZABBIX monitoring of lamp architecture (2): ZABBIX basic operation

逆袭大学生的职业规划

Symbol of array element product of leetcode simple problem

Network security textual research recommendation

Leetcode simple question: the key with the longest key duration

2022 registration of G2 utility boiler stoker examination and G2 utility boiler stoker reexamination examination
![[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa](/img/a9/92059db74ccde03b84c69dfce35b37.jpg)
[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa

Shuttle + Alluxio 加速内存Shuffle起飞
随机推荐
Internationalization and localization, dark mode and dark mode in compose
Golang -- realize file transfer
[PHP vulnerability weak type] basic knowledge, PHP weak equality, error reporting and bypassing
Market status and development prospect forecast of global button dropper industry in 2022
Shuttle + Alluxio 加速内存Shuffle起飞
JS multidimensional array to one-dimensional array
MPM model and ab pressure test
[BMZCTF-pwn] 18-RCTF-2017-Recho
Valentine's day limited withdrawal guide: for one in 200 million of you
Preparation for school and professional cognition
Day 51 - tree problem
Learning record of arouter principle
Integration of Android high-frequency interview questions (including reference answers)
Library management system based on SSM
GFS distributed file system (it's nice to meet it alone)
[set theory] binary relation (example of binary relation on a | binary relation on a)
【工具跑SQL盲注】
Market status and development prospect prediction of global colorimetric cup cover industry in 2022
Career planning of counter attacking College Students
AWS VPC