zoukankan      html  css  js  c++  java
  • GetCurrentTime() and CFile option

    获取当前时间

    CTime tm = CTime::GetCurrentTime();

    将当前时间转换成sctring类型+.txt

    1 CString str2;
    2 str2.Format(_T("%d%d%d_%d%d%d.txt"),tm.GetYear(),tm.GetMonth(),tm.GetDay(),tm.GetHour(),tm.GetMinute(),tm.GetSecond());

    将字符串定义为文件名称,并创建该文件,将编辑框内容写入文件内:

    1 CFile c_flie;
    2 if(c_flie.Open(str2,CFile::modeWrite|CFile::modeCreate))
    3    {
    4       CString m_str;
    5       CEdit *pEdit = (CEdit *)this->GetDlgItem(IDC_EDIT15);
    6       pEdit->GetWindowText(m_str);
    7       c_flie.Write(m_str,m_str.GetLength());
    8       c_flie.Close();
    9     }

    End

    thanks.

  • 相关阅读:
    Git 基本操作
    Git 基础
    MarkDown教程
    Python常用函数
    Python生成器
    Python列表生成式
    Python迭代
    Python切片
    Python函数
    Python不可变对象
  • 原文地址:https://www.cnblogs.com/lumao1122-Milolu/p/11412705.html
Copyright © 2011-2022 走看看