/*---- chkimf.c 2001.07.04 ----*/
/* coded by M. Oshima 2001.07.04  */
/* --- last modification                      2001.07.04     */
#include <stdio.h>

typedef struct{
  int magic;
  int width;
  int height;
  int depth;
  int length;
  int type;
  int maptype;
  int maplength;
} rasterfile;

rasterfile       raster;


int main(int argc, char **argv)
{
  char name[50];
  int         width, height;
  char        *dummy;
  FILE        *fpin;

  if( argc != 2 ){
    printf("Usage: %s [data_name]\n", argv[0]);
    exit(1);
  }

  name[0] = '\0';
  strcat(name, argv[1]);

  fpin = fopen(name, "r");
  if(fpin == NULL){
    fprintf(stderr, "error: can't open %s!\n", name);
    exit(1);
  }

  fread(&raster, sizeof(raster), 1, fpin);
  width  = raster.width;
  height = raster.height;

  printf("filename =%s\n",name);
  printf("magic = %x, width = %d, height = %d, depth = %d,\nlength = %d, 
type =
%d, maptype = %d, maplength = %d\n",
         raster.magic,raster.width,raster.height,raster.depth,
         raster.length,raster.type,raster.maptype,raster.maplength);

  fclose(fpin);
}


–ß‚é