OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
getlut_file.c
Go to the documentation of this file.
1 /*
2  get red, green and blue look up table from an ascii file
3  */
4 #include <genutils.h>
5 
6 #include <stdio.h>
7 
8 int getlut_file(char *lut_file, short *rlut, short *glut, short * blut) {
9  int i;
10  FILE *file_ptr;
11 
12  if ((file_ptr = fopen(lut_file, "r")) == NULL) {
13  printf("[getlut_file] error opening the lut file\n");
14  return (1);
15  }
16 
17  /* read the luts from file */
18 
19  for (i = 0; i < 256; i++) {
20  fscanf(file_ptr, "%hd%hd%hd\n", &rlut[i], &glut[i], &blut[i]);
21  }
22 
23  fclose(file_ptr);
24 
25  return (0);
26 }
27 
#define NULL
Definition: decode_rs.h:63
int getlut_file(char *lut_file, short *rlut, short *glut, short *blut)
Definition: getlut_file.c:8
int i
Definition: decode_rs.h:71