当前位置:网站首页>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
边栏推荐
猜你喜欢
深蓝学院激光slam理论与实践 -第二章(里程计标定)作业
【UDS统一诊断服务】二、网络层协议(1)— 网络层概述与功能
CUDA环境安装
Running QT program in visual Stdio
【UDS统一诊断服务】三、应用层协议(1)
[UDS unified diagnostic service] II. Network layer protocol (2) - data transmission rules (single frame and multi frame)
C#【文件操作篇】PDF文件和图片互相转换
【UDS统一诊断服务】四、诊断典型服务(1)— 诊断和通信管理功能单元
基于TensorFlow的线性回归实例
【UDS统一诊断服务】(补充)五、ECU bootloader开发要点详解 (1)
随机推荐
Shell脚本 单引号、双引号和反引号的区别
非参数化相机畸变模型简介
cv_bridge 与opencv 版本不匹配的解决
Class inheritance and derivation
Installation of GCC, G + +, GDB
Protection of shared data
Eigen 库常用基本用法 备忘
[UDS unified diagnostic service] IV. typical diagnostic service (5) - function / component test function unit (routine function unit 0x31)
C语言 #和##的使用
VHDL 有限状态机(FSM) 代码示例
拷贝构造函数
[stepping on the pit] MELD in win11 wsl2 cannot be used normally. Problem repair
Object array and object pointer
Jeu de devinettes
进程间通信-互斥锁
[UDS unified diagnosis service] IV. typical diagnosis service (1) - diagnosis and communication management function unit
Make your own small program
【UDS统一诊断服务】一、诊断概述(3)— ISO 15765体系结构
如何读文献
ARM常用汇编指令