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 / vtest1.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-20  |  725 b   |  33 lines  |  [TEXT/????]

  1. #include "vg.h"
  2. #define FS "vtest1.hdf"
  3. main(ac,av) int ac; char**av; {
  4.  int num;
  5.  
  6.   if(ac!=2) num = 10; else sscanf(av[1],"%d",&num);
  7.     printf("%s: creates %d vgroups and %d vdatas in %s\n",av[0],num,num,FS);
  8.     createm(FS,num);
  9. }
  10. createm(fs,n) char*fs; int n;{
  11.   VGROUP * vg;
  12.   VDATA * vs;
  13.     DF * f;
  14.     char ss[30];
  15.     int i;
  16.  
  17.     if( NULL==(f=DFopen(fs,DFACC_ALL,0))) { printf("open err%s\n",fs); exit(0);}
  18.     for(i=0;i<n;i++) {
  19.       vg = (VGROUP*) Vattach(f,-1,"w");
  20.       sprintf(ss,"gp#%d",i); Vsetname(vg,ss);
  21.       Vdetach(vg);
  22.       }
  23.     for(i=0;i<n;i++) {
  24.       vs = (VDATA*) VSattach(f,-1,"w");
  25.       sprintf(ss,"vdata#%d",i); VSsetname(vs,ss); 
  26.       VSsetfields(vs,"IX");
  27.       VSwrite(vs,ss,1,FULL_INTERLACE);
  28.       VSdetach(vs);
  29.       }
  30.     DFclose(f);
  31. }
  32.  
  33.