当前位置:网站首页>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.
边栏推荐
- Shuttle + Alluxio 加速内存Shuffle起飞
- Market status and development prospects of the global automatic tea picker industry in 2022
- STM32 reverse entry
- Php+mysql registration landing page development complete code
- Thesis reading_ Chinese NLP_ ELECTRA
- Market status and development prospect forecast of global button dropper industry in 2022
- Leetcode simple question: check whether the array is sorted and rotated
- 2022 registration examination for safety production management personnel of hazardous chemical production units and examination skills for safety production management personnel of hazardous chemical
- 联发科技2023届提前批IC笔试(题目)
- JVM原理简介
猜你喜欢

stm32逆向入门
![[tools run SQL blind note]](/img/c3/86db4568b221d2423914990a88eec2.png)
[tools run SQL blind note]

2022 t elevator repair simulation examination question bank and t elevator repair simulation examination question bank

Truncated sentences of leetcode simple questions

Symbol of array element product of leetcode simple problem

Thesis reading_ Chinese NLP_ ELECTRA

【XSS绕过-防护策略】理解防护策略,更好的绕过
![[luatos sensor] 2 air pressure bmp180](/img/88/2a6caa5fec95e54e3fb09c74ba8ae6.jpg)
[luatos sensor] 2 air pressure bmp180

Introduction to JVM principle

Pyqt control part (II)
随机推荐
Matplotlib -- save graph
ZABBIX monitoring of lamp architecture (2): ZABBIX basic operation
How to choose cross-border e-commerce multi merchant system
雇佣收银员(差分约束)
[set theory] binary relation (example of binary relation operation | example of inverse operation | example of composite operation | example of limiting operation | example of image operation)
Why does I start with =1? How does this code work?
[set theory] binary relationship (special relationship type | empty relationship | identity relationship | global relationship | divisive relationship | size relationship)
Golang -- realize file transfer
[PHP vulnerability weak type] basic knowledge, PHP weak equality, error reporting and bypassing
Market status and development prospects of the global autonomous marine glider industry in 2022
Learning practice: comprehensive application of cycle and branch structure (I)
Market status and development prospect prediction of the global forward fluorescent microscope industry in 2022
Youdao cloud notes
Network security textual research recommendation
The reason why the entity class in the database is changed into hump naming
MySQL winter vacation self-study 2022 12 (3)
Web security - CSRF (token)
AWS VPC
Human resource management system based on JSP
GFS distributed file system (it's nice to meet it alone)