home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Applications / UIFlow 1.0.1 / UIFlow Source / VSet2.0 / Src / vtest7.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-20  |  936 b   |  43 lines  |  [TEXT/????]

  1. #include "vg.h"
  2. #define FS "vtest7.hdf"
  3. main(ac,av) int ac; char**av; {
  4.  int num;
  5.  
  6.   printf("This is an example of writing sequentially to several vdatas simultaneously.\n"); 
  7.   printf("Note that the file size is far bigger than expected.\n");
  8.  
  9.   if(ac!=2) num = 2; else sscanf(av[1],"%d",&num);
  10.     printf("%s: creates %d vgroups and %d vdatas in %s\n",av[0],num,num,FS);
  11.     createm(FS,num);
  12. }
  13. createm(fs,n) char*fs; int n;{
  14.   VGROUP * vg;
  15.   VDATA * vs[10];
  16.     DF * f;
  17.     int i,j, nv;
  18.     float bb[100];
  19.  
  20.     for(i=0;i<100;i++) bb[i] = 1000.0 + i;    
  21.  
  22.     if(n>=10) n=10;
  23.     printf("will create and write to %d vdatas\n",n);
  24.  
  25.     if( NULL==(f=DFopen(fs,DFACC_ALL,0))) { printf("open err%s\n",fs); exit(0);}
  26.  
  27.     for(i=0;i<n;i++) {
  28.       vs[i] = (VDATA*) VSattach(f,-1,"w");
  29.       VSsetfields(vs[i],"IX");
  30.       }
  31.  
  32.     nv = 1;
  33.     for(j=0;j<10;j++) {
  34.       for(i=0;i<n;i++)  VSwrite(vs[i],bb,nv,FULL_INTERLACE);
  35.       nv++;
  36.     }
  37.  
  38.     for(i=0;i<n;i++) { VSdetach(vs[i]); }
  39.  
  40.     DFclose(f);
  41. }
  42.  
  43.