ipad怎么验证正品:C++如何把全部私有数据存入磁盘文件里

来源:百度文库 编辑:高考问答 时间:2024/05/06 00:38:35
我要的是C++程序语句 最好有列子

#include <stdio.h>

class AA
{
int a;
int b;
float c;
public;
int Save(const char* file);
};

int AA::Save(const char* file)
{
FILE* fp = NULL;
fp = fopen(file, "wb");
if(NULL == fp)
return 0;

fwrite(&a, sizeof(int), 1, fp);
fwrite(&b, sizeof(int), 1, fp);
fwrite(&c, sizeof(float), 1, fp);

fclose(fp);
return 1;
}