一个不错的错误提醒宏
#include <stdio.h>
#define err(str) \
fprintf (stderr, "Error occurred in: %s, line %d. Msg: %s\n", \
__FILE__, __LINE__, str);
其实还可以扩展
1. 将错误写入日志
2. 日志中包含信息有: 时间/文件名/行数/错误提示
每天早上叫醒你的不是闹钟,而是心中的梦~
#include <stdio.h>
#define err(str) \
fprintf (stderr, "Error occurred in: %s, line %d. Msg: %s\n", \
__FILE__, __LINE__, str);
其实还可以扩展
1. 将错误写入日志
2. 日志中包含信息有: 时间/文件名/行数/错误提示