int main(int argc,char *argv[]) { unsigned char zflg=0; unsigned char help=0; unsigned char option=0; struct DataMap *dmap=NULL; struct IDLFile *fp=NULL; OptionAdd(&opt,"-help",'x',&help); OptionAdd(&opt,"-option",'x',&option); OptionAdd(&opt,"z",'x',&zflg); arg=OptionProcess(1,argc,argv,&opt,NULL); if (help==1) { OptionPrintInfo(stdout,hlpstr); exit(0); } if (option==1) { OptionDump(stdout,&opt); exit(0); } if (arg !=argc) fp=IDLOpen(argv[arg],zflg); else fp=IDLFdopen(fileno(stdin),zflg); dmap=IDLReadSave(fp); if (dmap==NULL) return 0; if (zflg) { gzFile gz=0; gz=gzdopen(fileno(stdout),"w"); DataMapWriteZ(gz,dmap); gzclose(gz); } else DataMapFwrite(stdout,dmap); return 0; }
int main(int argc,char *argv[]) { int t,n; float set[3]={0.1,0.2,10.2}; int32 dim=1; int32 rng[1]={3}; struct DataMap *dmap; dmap=DataMapMake(); DataMapAddArray(dmap,"set",DATAFLOAT,dim,rng,&set); for (t=0;t<100;t++) { for (n=0;n<3;n++) set[n]=set[n]+0.1; DataMapFwrite(stdout,dmap); } DataMapFree(dmap); return 0; }