level 1
hzh00772
楼主
本人写了一个
#include "StdAfx.h"
#include <stdio.h>
#include <stdlib.h>
//using namespace std;
struct BlockInfo {
double x;
double y;
double h;
};
int main() {
//FILE *f1=fopen("c:\\1\\2.csv","r");
FILE* f = fopen("c:\\1\\booltest", "w");
BlockInfo* blockInfo = (BlockInfo*)malloc(sizeof(blockInfo));
//493161.66,4478847.05,188
blockInfo->x=493161.66;/////将该值改为 193161.66 就占 24个字节 可没有溢出呀? 问题载哪呢???
blockInfo->y=4478847.05;
blockInfo->h=188.00;
fwrite(blockInfo, sizeof(BlockInfo), 1, f);
fclose(f);
printf("ok");
return 0;
}
将数据写到二进制文件的程序,三个双精度数,本以为占24个字节,实际是25个,求助大神!
2020年12月26日 14点12分
1
#include "StdAfx.h"
#include <stdio.h>
#include <stdlib.h>
//using namespace std;
struct BlockInfo {
double x;
double y;
double h;
};
int main() {
//FILE *f1=fopen("c:\\1\\2.csv","r");
FILE* f = fopen("c:\\1\\booltest", "w");
BlockInfo* blockInfo = (BlockInfo*)malloc(sizeof(blockInfo));
//493161.66,4478847.05,188
blockInfo->x=493161.66;/////将该值改为 193161.66 就占 24个字节 可没有溢出呀? 问题载哪呢???
blockInfo->y=4478847.05;
blockInfo->h=188.00;
fwrite(blockInfo, sizeof(BlockInfo), 1, f);
fclose(f);
printf("ok");
return 0;
}
将数据写到二进制文件的程序,三个双精度数,本以为占24个字节,实际是25个,求助大神!
