当前位置:网站首页>日志写法(带时间)
日志写法(带时间)
2022-04-23 05:48:00 【老朽在门外】
#include <windows.h>
#include <stdio.h>
/// <summary>
/// 写日志文件
/// </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();
}
版权声明
本文为[老朽在门外]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_41167925/article/details/121019637
边栏推荐
- Jeu de devinettes
- 猜數字遊戲
- Graduation project, viewing screenshots of epidemic psychological counseling system
- 基于Sentinel+Nacos 对Feign Client 动态添加默认熔断规则
- 【UDS统一诊断服务】四、诊断典型服务(6)— 输入输出控制单元(0x2F)
- Excel打开超大csv格式数据
- 1006 finding a mex (hdu6756)
- 1007 go running (hdu6808) in the fourth game of 2020 Hangzhou Electric Multi school competition
- C语言数组处理批量数据
- Rust:如何 match 匹配 String 字符串?
猜你喜欢
随机推荐
Make your own small program
搭建openstack平台
搭建jpress个人博客
Rust 中的 Rc智能指针
函数的调用过程
Class inheritance and derivation
【UDS统一诊断服务】五、诊断应用示例:Flash Bootloader
解决ArcGIS分区统计显示太多唯一值执行失败
1007 go running (hdu6808) in the fourth game of 2020 Hangzhou Electric Multi school competition
SVN简单操作命令
Protection of shared data
C语言的浪漫
vs中的多字节与unicode
Vscode custom comments
数组旋转
Flask - 中间件
C#中?的这种形式
C#【文件操作篇】按行读取txt文本
【UDS统一诊断服务】(补充)五、ECU bootloader开发要点详解 (1)
MySQL groups are sorted by a field, and the first value is taken