69,371
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
double d[200*100000];
FILE *f;
int y,x;
int main() {
for (y=0;y<200;y++) {
x=0;
d[y*100000+x]=(double)y*100000.0+(double)x;
x=99999;
d[y*100000+x]=(double)y*100000.0+(double)x;
}
f=fopen("d.dat","wb");
fwrite(d,sizeof(double),200*100000,f);
fclose(f);
for (y=0;y<200;y++) {
x=0;
d[y*100000+x]=0.0;
x=99999;
d[y*100000+x]=0.0;
}
f=fopen("d.dat","rb");
fread(d,sizeof(double),200*100000,f);
fclose(f);
for (y=0;y<200;y++) {
x=0;
printf("%.15lg,",d[y*100000+x]);
x=99999;
printf("%.15lg\n",d[y*100000+x]);
}
return 0;
}
//0,99999
//100000,199999
//200000,299999
//300000,399999
//400000,499999
//500000,599999
//600000,699999
//700000,799999
//800000,899999
//900000,999999
//1000000,1099999
//1100000,1199999
//1200000,1299999
//1300000,1399999
//1400000,1499999
//1500000,1599999
//1600000,1699999
//1700000,1799999
//1800000,1899999
//1900000,1999999
//2000000,2099999
//2100000,2199999
//2200000,2299999
//2300000,2399999
//2400000,2499999
//2500000,2599999
//2600000,2699999
//2700000,2799999
//2800000,2899999
//2900000,2999999
//3000000,3099999
//3100000,3199999
//3200000,3299999
//3300000,3399999
//3400000,3499999
//3500000,3599999
//3600000,3699999
//3700000,3799999
//3800000,3899999
//3900000,3999999
//4000000,4099999
//4100000,4199999
//4200000,4299999
//4300000,4399999
//4400000,4499999
//4500000,4599999
//4600000,4699999
//4700000,4799999
//4800000,4899999
//4900000,4999999
//5000000,5099999
//5100000,5199999
//5200000,5299999
//5300000,5399999
//5400000,5499999
//5500000,5599999
//5600000,5699999
//5700000,5799999
//5800000,5899999
//5900000,5999999
//6000000,6099999
//6100000,6199999
//6200000,6299999
//6300000,6399999
//6400000,6499999
//6500000,6599999
//6600000,6699999
//6700000,6799999
//6800000,6899999
//6900000,6999999
//7000000,7099999
//7100000,7199999
//7200000,7299999
//7300000,7399999
//7400000,7499999
//7500000,7599999
//7600000,7699999
//7700000,7799999
//7800000,7899999
//7900000,7999999
//8000000,8099999
//8100000,8199999
//8200000,8299999
//8300000,8399999
//8400000,8499999
//8500000,8599999
//8600000,8699999
//8700000,8799999
//8800000,8899999
//8900000,8999999
//9000000,9099999
//9100000,9199999
//9200000,9299999
//9300000,9399999
//9400000,9499999
//9500000,9599999
//9600000,9699999
//9700000,9799999
//9800000,9899999
//9900000,9999999
//10000000,10099999
//10100000,10199999
//10200000,10299999
//10300000,10399999
//10400000,10499999
//10500000,10599999
//10600000,10699999
//10700000,10799999
//10800000,10899999
//10900000,10999999
//11000000,11099999
//11100000,11199999
//11200000,11299999
//11300000,11399999
//11400000,11499999
//11500000,11599999
//11600000,11699999
//11700000,11799999
//11800000,11899999
//11900000,11999999
//12000000,12099999
//12100000,12199999
//12200000,12299999
//12300000,12399999
//12400000,12499999
//12500000,12599999
//12600000,12699999
//12700000,12799999
//12800000,12899999
//12900000,12999999
//13000000,13099999
//13100000,13199999
//13200000,13299999
//13300000,13399999
//13400000,13499999
//13500000,13599999
//13600000,13699999
//13700000,13799999
//13800000,13899999
//13900000,13999999
//14000000,14099999
//14100000,14199999
//14200000,14299999
//14300000,14399999
//14400000,14499999
//14500000,14599999
//14600000,14699999
//14700000,14799999
//14800000,14899999
//14900000,14999999
//15000000,15099999
//15100000,15199999
//15200000,15299999
//15300000,15399999
//15400000,15499999
//15500000,15599999
//15600000,15699999
//15700000,15799999
//15800000,15899999
//15900000,15999999
//16000000,16099999
//16100000,16199999
//16200000,16299999
//16300000,16399999
//16400000,16499999
//16500000,16599999
//16600000,16699999
//16700000,16799999
//16800000,16899999
//16900000,16999999
//17000000,17099999
//17100000,17199999
//17200000,17299999
//17300000,17399999
//17400000,17499999
//17500000,17599999
//17600000,17699999
//17700000,17799999
//17800000,17899999
//17900000,17999999
//18000000,18099999
//18100000,18199999
//18200000,18299999
//18300000,18399999
//18400000,18499999
//18500000,18599999
//18600000,18699999
//18700000,18799999
//18800000,18899999
//18900000,18999999
//19000000,19099999
//19100000,19199999
//19200000,19299999
//19300000,19399999
//19400000,19499999
//19500000,19599999
//19600000,19699999
//19700000,19799999
//19800000,19899999
//19900000,19999999
//
double buf[200][10000];
double** p=buf;
FILE* p_file=fopen("文件名","w");
while(*p!=NULL){
fwrite(*p,sizeof(double)*10000,1,p_file);
p++;
}
fclose(p_file);
写的话差不多。