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