MED fichier
MEDmemFileOpen.c
Aller à la documentation de ce fichier.
1/* This file is part of MED.
2 *
3 * COPYRIGHT (C) 1999 - 2020 EDF R&D, CEA/DEN
4 * MED is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * MED is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with MED. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18
19#include <med.h>
20#include <med_config.h>
21#include <med_outils.h>
22
23#ifdef PPRO_NT_CALL
24#define F_OK 0
25#else
26#include <unistd.h>
27#endif
28
43MEDmemFileOpen(const char* const filename, med_memfile * const memfile, const med_bool filesync, const med_access_mode accessmode)
44{
45 med_idt _fid = 0;
46 med_err _ret = -1;
47 /* med_bool file_exist = MED_FALSE; */
48
49 /*
50 * ON inhibe le gestionnaire d'erreur HDF
51 */
53
54 /*
55 * On ouvre le fichier MED sous HDF
56 */
57 switch(accessmode)
58 {
59 case MED_ACC_RDONLY :
60 case MED_ACC_CREAT :
61 case MED_ACC_RDWR :
62 if ((_fid = _MEDmemFileOpen((char *) filename, memfile, filesync, accessmode)) < 0) {
64 goto ERROR;
65 }
66 break;
67
68 case MED_ACC_RDEXT :
70 break;
71
72 default :
74 goto ERROR;
75 }
76
77 _ret=0;
78 ERROR:
79
80 if (_ret < 0)
81 _fid = (med_idt) _ret;
82
83 return _fid;
84}
85
med_idt MEDmemFileOpen(const char *const filename, med_memfile *const memfile, const med_bool filesync, const med_access_mode accessmode)
Ouverture d'un fichier MED pour une utilisation en mémoire.
med_bool
Definition: med.h:260
herr_t med_err
Definition: med.h:323
med_access_mode
Definition: med.h:120
@ MED_ACC_RDEXT
Definition: med.h:122
@ MED_ACC_RDONLY
Definition: med.h:120
@ MED_ACC_CREAT
Definition: med.h:123
@ MED_ACC_RDWR
Definition: med.h:121
hid_t med_idt
Definition: med.h:322
#define MED_ERR_OPEN
Definition: med_err.h:37
#define MED_ERR_MEMFILE
Definition: med_err.h:129
#define MED_ERR_INIT
Definition: med_err.h:33
#define MED_ERR_CREATE
Definition: med_err.h:27
MEDC_EXPORT med_idt _MEDmemFileOpen(const char *const filename, med_memfile *const memfile, const med_bool filesync, const med_access_mode accessmode)
MEDC_EXPORT void _MEDmodeErreurVerrouiller(void)
#define MED_ERR_(rt, r1, r2, r3)
Definition: med_utils.h:160
Structure d'acceuil du buffer d'un fichier MED en mémoire.
Definition: med.h:384
#define filename
Definition: test10.c:73