0
点赞
收藏
分享

微信扫一扫

【MySQL】MySQL的JSON特性

秀妮_5519 2024-08-11 阅读 28

写二进制文件和写普通文件的不同点:

代码示例如下:

#include<iostream>
using namespace std;
#include<fstream>
#include<string>

class Person
{
public:
	char m_Name[64];
	int m_Age;
};

void test01()
{
	ofstream ofs("我家咯咯.txt", ios::out | ios::binary);

	//ofs.open("我家咯咯.txt", ios::out | ios::binary);

	Person p = { "菜虚坤", 18 };

	ofs.write((const char*)&p, sizeof(p));
}

int main() {
	test01();
}

文件就创建好了(方块是因为二进制 ,读的时候会还原):

举报

相关推荐

0 条评论