OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
hio_open.c
Go to the documentation of this file.
1 #include "hio.h"
2 #include <mfhdf.h>
3 
4 int32_t hio_open(char *fname, int32_t mode, hio_struct *info)
5 /*******************************************************************
6 
7  hio_open
8 
9  purpose: open a general hdf file
10 
11  Returns type: int32 - return status: 0 is good
12  -1 if any other error
13 
14  Parameters: (in calling order)
15  Type Name I/O Description
16  ---- ---- --- -----------
17  char * fname I name of file to open
18  int32 mode I open mode: DFACC_RDONLY,
19  DFACC_CREATE, DFACC_RDWR
20  struct hio_struct * info O information struct
21  about the opened file
22 
23  Modification history:
24  Programmer Date Description of change
25  ---------- ---- ---------------------
26  W. Robinson 5-Feb-1997 Original development
27 
28  *******************************************************************/
29  {
30 
31  if (((mode == DFACC_RDONLY) || (mode == DFACC_RDWR)) &&
32  !Hishdf(fname)) {
33  printf("hio_open: Failure at Hishdf of \n%s\n", fname);
34  return -1;
35  }
36  /*
37  * SDstart opens the hdf interface and inits the SD interface, wierd.
38  * apparently, if both SD and HDF are used, both these need to
39  * be called.
40  */
41  if ((info->sdfid = SDstart(fname, mode)) < 0) {
42  printf("hio_open: Failure at SDstart of \n%s\n", fname);
43  hio_close(*info);
44  return -1;
45  }
46 
47  /*
48  */
49  if ((info->fid = Hopen(fname, DFACC_RDONLY, 0)) < 0) {
50  printf("hio_open: Failed on the Hopen of \n%s\n", fname);
51  return -1;
52  }
53  /*
54  * ok, it's open.
55  */
56  return 0;
57 
58 }
int32_t hio_open(char *fname, int32_t mode, hio_struct *info)
Definition: hio_open.c:3
README for MOD_PR02AQUA(AQUA) Version to set to For disabling creating and output data sets when in night mode
Definition: README.txt:96
int32 hio_close(hio_struct)
Definition: hio_close.c:3