当前位置:网站首页>Log writing method (with time)
Log writing method (with time)
2022-04-23 06:43:00 【The old man is outside the door】
#include <windows.h>
#include <stdio.h>
/// <summary>
/// Write a log file
/// </summary>
/// <param name="msg"></param>
/// <param name="value"></param>
void CwriteLog(std::string msg) {
SYSTEMTIME sys;
GetLocalTime(&sys);
char temp[256];
sprintf(temp, "%4d-%02d-%02d %02d:%02d:%02d-",
sys.wYear, sys.wMonth,
sys.wDay, sys.wHour,
sys.wMinute, sys.wSecond);
std::ofstream ofs("update_log.txt", std::ios::app);
ofs << temp <<msg << std::endl;
ofs.close();
}
版权声明
本文为[The old man is outside the door]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230548039097.html
边栏推荐
猜你喜欢
死区时间的分析与设置
For() loop parameter call order
【UDS统一诊断服务】五、诊断应用示例:Flash Bootloader
[UDS unified diagnosis service] IV. typical diagnosis service (3) - read fault information function unit (storage data transmission function unit)
[UDS unified diagnosis service] IV. typical diagnosis service (1) - diagnosis and communication management function unit
cv_bridge 与opencv 版本不匹配的解决
函数的调用过程
[untitled]
[UDS unified diagnostic service] III. application layer protocol (1)
PHP junior programmers, take orders and earn extra money
随机推荐
C语言中volatile的使用
[UDS unified diagnosis service] i. diagnosis overview (1) - diagnosis overview
进程间通信-互斥锁
汇编基础代码示例
卷积神经网络实现CIFAR100数据集分类
[untitled]
2022LDU寒假训练-程序补丁
Graduation project, curriculum link, student achievement evaluation system
ROS包nmea_navsat_driver读取GPS、北斗定位信息笔记
共用数据的保护
C语言进阶要点笔记3
【UDS统一诊断服务】三、应用层协议(2)
Notes on advanced points of C language 2
The waterfall waterfall flow of uview realizes single column and loads more
C语言进阶要点笔记4
Camera calibration: key point method vs direct method
Eigen 学习总结
gcc ,g++,gdb的安装
声明为全局变量
Static member