首页 > 用户发贴区 > 编程问题提问区 > 求助啊,求助~
2008
07-18
那位高人能指点一下,下面这段程序在写入数据的时候是怎么写入的啊? 是先循环14还是先循环800×800的数组?谢了~紧急啊~~~(NumY=NumY=800)

void WriteCloudStats(GRIDDEF *griddef, char *StatsDir, int month, int year, short ****DataTable)
{

     FILE *fptr[2];
     int i,j,k,l;
     char filename[200],command[250],monstr[5];
     GRIDDEF header;
         
     if(month < 10)
        sprintf(monstr,”0%d”,month);
     else
        sprintf(monstr,”%d”,month);
     
     sprintf(filename,”%s/CldYearlyStats_%d_%d.dat”,StatsDir,month,year);
     sprintf(command,”/bin/cp %s %s.arc”,filename,filename);
     system(command);
     fptr[0] = fopen(filename,”w”);
     sprintf(filename,”%s/CldTotalStats_%d.dat”,StatsDir,month);
     sprintf(command,”/bin/cp %s %s.arc”,filename,filename);
     system(command);
     fptr[1] = fopen(filename,”w”);

     for(i=0; i<2; i++){
         if(fptr[i] != NULL){
            WriteHeader(griddef,fptr[i]);
           for(j=0; j<14; j++)fwrite(
                                     &DataTable[i][j][0][0],
                                     sizeof(short),
                                     griddef->NumX*griddef->NumY,
                                     fptr[i]            
                   );
printf(“Data is %d \n”,&DataTable[i][j][0][0]);
            fclose(fptr[i]);
         }
     }
}


求助啊,求助~》有 1 条评论

  1. xstar 说:

    先循环14(800*800没循环)
    文件结构
    DataTable[0][0][0][0]        // 第一块 800 * 800 * sizeof(short)字节长度
    DataTable[0][1][0][0]        // 第二块 800 * 800 * sizeof(short)字节长度

    DataTable[0][n][0][0]        // 第n块 800 * 800 * sizeof(short)字节长度

留下一个回复