Skip to content

Instantly share code, notes, and snippets.

@guangxuanliu
Created June 12, 2023 11:51
Show Gist options
  • Save guangxuanliu/2ba286a38ec05518131ab4944997ffcc to your computer and use it in GitHub Desktop.
Save guangxuanliu/2ba286a38ec05518131ab4944997ffcc to your computer and use it in GitHub Desktop.
以追加模式写日志文件,指针
#include <iostream>
#include <sstream>
#include <fstream>
using namespace std;
int main()
{
std::ofstream outfile;
outfile.open("example.txt", std::ios_base::app); // 以追加模式打开文件
int* p = new int(15);
cout << std::hex << p << endl;
outfile << std::hex << p << std::endl;
outfile.close();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment