Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/134.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 每次程序运行时都会创建一个新文件_C++_Filestream_Notepad - Fatal编程技术网

C++ 每次程序运行时都会创建一个新文件

C++ 每次程序运行时都会创建一个新文件,c++,filestream,notepad,C++,Filestream,Notepad,只是一个简单的问题,当我运行c++程序时,是否可以创建一个新的文本文件?我有一个航空公司预订计划,我想用记事本保存每个用户的交易记录。如果可能,怎么做?谢谢大家! 使用guid生成唯一的文件名: GUID guidNew = __uuidof(0); HRESULT hr = ::CoCreateGuid(&guidNew); ASSERT(SUCCEEDED(hr)); CComBSTR bstrGUID(guidNew); CString s

只是一个简单的问题,当我运行c++程序时,是否可以创建一个新的文本文件?我有一个航空公司预订计划,我想用记事本保存每个用户的交易记录。如果可能,怎么做?谢谢大家!

使用guid生成唯一的文件名:

    GUID guidNew = __uuidof(0);
    HRESULT hr = ::CoCreateGuid(&guidNew);
    ASSERT(SUCCEEDED(hr));

    CComBSTR bstrGUID(guidNew);
    CString sGUID(bstrGUID);

    //remove braces
    sGUID.Mid(1, sGUID.GetLength() - 2);

将文件名(可能是数字,为了方便起见,每次读取文件时都添加一个新的数字)存储在另一个文件中如何?