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 / temp / vtest3.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-12  |  1.3 KB  |  58 lines  |  [TEXT/????]

  1. #include "vg.h"
  2. #define filef "vta.hdf"
  3. #define fileg "vtb.hdf"
  4. main() {
  5. DF * f, *g;
  6. VGROUP* vg1, * vg2;
  7. VDATA *vs1, * vs2;
  8. char ss[50];
  9. int i,j,k;
  10. int bb[5000];
  11. for(i=0;i<5000;i++) bb[i] =i;
  12. printf("this test creates 2 files [%s] and [%s] and perform sequential ",
  13. filef, fileg);
  14. printf(" writes on 3 vdatas in each file simultaneously\n");
  15.  
  16.   if( NULL==(f=DFopen(filef,DFACC_ALL,0))) 
  17.     { printf(" %s open err\n",filef); exit(0); }
  18.  
  19.   if( NULL==(g=DFopen(fileg,DFACC_ALL,0))) 
  20.     { printf(" %s open err\n",fileg); exit(0); }
  21. printf(" both files opned ok \n");
  22.  
  23.  
  24. /*** PART 3: vgroups and vdatas  with sequential writes ***/
  25.  
  26.  vg1 = (VGROUP*) Vattach(f,-1,"w"); 
  27.  sprintf(ss,"vgroup ONE  in %s",filef); Vsetname(vg1,ss);
  28.  fprintf(stderr,"******vg [%s] ok\n",ss);
  29.  
  30.  vg2 = (VGROUP*) Vattach(g,-1,"w"); 
  31.  sprintf(ss,"vgroup TWO  in %s",fileg); Vsetname(vg2,ss);
  32.  fprintf(stderr,"******vg [%s] ok\n",ss);
  33.  
  34. for(i=0;i<2;i++) {
  35.   vs1 = (VDATA*) VSattach(f,-1,"w");
  36.   vs2 = (VDATA*) VSattach(g,-1,"w");
  37.   VSsetfields(vs1,"IX");
  38.   VSsetfields(vs2,"IY");
  39.   for(j=0;j<10;j++) {
  40.     VSwrite(vs1,(unsigned char*) &bb[200+j*10],3,FULL_INTERLACE);
  41.     VSwrite(vs2,(unsigned char*)&bb[100+j*10],5,FULL_INTERLACE);
  42.    }
  43.   Vinsert(vg1,vs1);
  44.   Vinsert(vg2,vs2);
  45.   VSdetach(vs1);
  46.   VSdetach(vs2);
  47.   }
  48.  
  49.   Vdetach(vg1);
  50.   Vdetach(vg2);
  51.  
  52.  
  53. DFclose(f);
  54. DFclose(g);
  55.  
  56. }
  57.  
  58.