home *** CD-ROM | disk | FTP | other *** search
/ Prima Shareware 3 / DuCom_Prima-Shareware-3_cd1.bin / PROGRAMO / C / ATOLKIT / CONVERT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-11-03  |  856 b   |  48 lines

  1. #include <stdio.h>
  2. #include <io.h>
  3. #include <stdlib.h>
  4.  
  5. main()
  6. {
  7.  FILE *fopen(), *input, *output;
  8.  char infilename[30], outfilename[30];
  9.  long int i, j, filelength(), len, position;
  10.  char c;
  11.  int    header = 778;
  12.  unsigned int width, height;
  13.  
  14.  
  15.  printf("\n Enter the input filename ");
  16.  gets(infilename);
  17.  printf("\n Enter the output filename ");
  18.  gets(outfilename);
  19.  
  20.  input  = fopen(infilename,  "rb");
  21.  output = fopen(outfilename, "wb");
  22.  
  23.  len = filelength( fileno(input) );
  24.  len-=header;
  25.  len/=4;
  26.  printf("filesize:%d", len);
  27.  
  28. for (i=0; i<header; i++)
  29.     {
  30.     c = fgetc(input);
  31.     fputc(c, output);
  32.     }
  33.  
  34.  for (i=0; i<4; i++)
  35.     {
  36.     rewind(input);
  37.     fseek(input, (header+i), SEEK_SET); 
  38.     for (j=len; j>0; j--)
  39.         {
  40.         c=getc(input);
  41.         fputc(c, output);
  42.         fseek(input, 3L, SEEK_CUR);
  43.         }
  44.     }
  45. fclose(input);
  46. fclose(output);
  47. }
  48.