OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
open_hdf.c
Go to the documentation of this file.
1 #include "l1io.h"
2 
3 #include <mfhdf.h>
4 
5 int32 open_hdf(char *fname, l1info_struct *l1info)
6 /*******************************************************************
7 
8  open_hdf
9 
10  purpose: open a general hdf file
11 
12  Returns type: int32 - return status: 0 is good
13 
14  Parameters: (in calling order)
15  Type Name I/O Description
16  ---- ---- --- -----------
17  char * fname I name of file to open
18  struct l1info_struct * l1info O information struct
19  about the opened file
20 
21  Modification history:
22  Programmer Date Description of change
23  ---------- ---- ---------------------
24  W. Robinson 5-Feb-1997 Original development
25 
26  *******************************************************************/
27  {
28 
29  /*
30  * hopen will open the file and read data descriptor blocks
31  * to memory
32  */
33  if ((l1info->fid = Hopen(fname, DFACC_RDONLY, 0)) < 0) {
34  printf("open_hdf: Failed on the Hopen of \n%s\n", fname);
35  return -1;
36  }
37 
38  /*
39  * SDstart opens the hdf interface and inits the SD interface, wierd.
40  * apparently, if both SD and HDF are used, both these need to
41  * be called.
42  */
43  if ((l1info->sdfid = SDstart(fname, DFACC_RDONLY)) < 0) {
44  printf("open_hdf: Failure at SDstart of \n%s\n", fname);
45  l1io_close(*l1info);
46  return -1;
47  }
48 
49  /*
50  * ok, it's open.
51  */
52  return 0;
53 
54 }
int32 open_hdf(char *fname, l1info_struct *l1info)
Definition: open_hdf.c:5
void l1io_close(l1info_struct)
Definition: l1io_close.c:4