#include <iostream>
#include <plug/plug.h>
using namespace std;
int main()
{
    int pid = GetCurrentProcessId();
    auto path = Plug::GetCurrentPath();//返回std::wstring
    path += L"test.txt";
    auto file = _wfopen(path.c_str(), L"wb");//写或者新建一个二进制文件
    char buf[10] = {0};
    itoa(pid, buf, 10);
    fwrite(buf, 6, 1, file);//arg2:单个字节数,arg3:写入的个数,arg4:目标文件指针
    fclose(file);
    getchar();
    return 0;
}

感觉没有c++fstream方便

相关文章:

  • 2021-11-30
  • 2022-12-23
  • 2021-11-30
  • 2021-11-30
  • 2021-09-08
猜你喜欢
  • 2022-12-23
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2021-11-30
相关资源
相似解决方案