File: ppm_handler.hc

package info (click to toggle)
craft 3.5-10
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 18,000 kB
  • ctags: 1,602
  • sloc: cpp: 3,794; makefile: 2,319; ansic: 857; sh: 385
file content (27 lines) | stat: -rw-r--r-- 777 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*======================================================================*/
/*                                                                      */
/* Routines for ppm file access                                         */
/*                                                                      */
/*======================================================================*/

#include <string.h>

#include "ppm_handler.h"
#include "xfile.h"

bool ppm_size (char name [], int &dx, int &dy, int &color)
  {if   (f_exists (name))
        get_size
   else return false;

.  get_size
     {FILE *f;
      char type [128]; 

      f = fopen (name, "r");
      fscanf (f, "%s %d %d %d", type, &dx, &dy, &color);
      fclose (f);
      return (strcmp (type, "P6") == 0);
     }.

  }