OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
countann.c
Go to the documentation of this file.
1 /*********************************************************************
2  * countann
3  *
4  * countann - count number of annotations in an HDF annotation file
5  * Brian Schieber SAIC/GSC 5/93
6  *********************************************************************/
7 
8 #include "ancil.h"
9 #include "ancnrt_proto.h"
10 
11 int count_annot(char *filename) {
12  int cnt;
13  FILE *fp;
14  char s[MAXDESCLEN];
15 
16  if ((fp = fopen(filename, "r")) == NULL) {
17  printf("Error opening %s\n", filename);
18  return (-1);
19  }
20 
21  cnt = 0;
22  while (fgets(s, 200, fp) != NULL) {
23  if (!strncmp(&s[0], "#", 1)) continue;
24  cnt++;
25  }
26 
27  fclose(fp);
28  return (cnt);
29 
30 } /* count_annot() */
#define NULL
Definition: decode_rs.h:63
#define MAXDESCLEN
Definition: ancil.h:42
int count_annot(char *filename)
Definition: countann.c:11
char filename[FILENAME_MAX]
Definition: atrem_corl1.h:122
data_t s[NROOTS]
Definition: decode_rs.h:75