home *** CD-ROM | disk | FTP | other *** search
/ Virtual Reality Zone / VRZONE.ISO / mac / PC / VDF / VDF.ZIP / VDFTEST.C < prev    next >
C/C++ Source or Header  |  1994-11-21  |  607b  |  39 lines

  1. /* Read a VDF file and write it out again */
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include "vdf.h"
  6.  
  7. void main(int argc, char *argv[])
  8.     {
  9.     VDF_DATA *ptr;
  10.     if (argc < 3)
  11.         {
  12.         fprintf(stderr, "usage: VDFTEST infile.vdf outfile.vdf\n");
  13.         exit(1);
  14.         }
  15.     ptr = vdf_readfile(argv[1]);
  16.     if (ptr == NULL)
  17.         {
  18.         puts(vdf_get_read_error());
  19.         exit(2);
  20.         }
  21.     if (vdf_writefile(argv[2], ptr))
  22.         {
  23.         puts(vdf_get_write_error());
  24.         exit(3);
  25.         }
  26.     }
  27.  
  28. #include <alloc.h>
  29.  
  30. void *vdf_malloc(unsigned int nbytes)
  31.     {
  32.     return malloc(nbytes);
  33.     }
  34.  
  35. void vdf_free(void *ptr)
  36.     {
  37.     free(ptr);
  38.     }
  39.