usecases/c/UsesCase_MEDfile_1.c
/* This file is part of MED.
*
* COPYRIGHT (C) 1999 - 2021 EDF R&D, CEA/DEN
* MED is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MED is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MED. If not, see <http://www.gnu.org/licenses/>.
*/
#include <med.h>
#define MESGERR 1
#include <med_utils.h>
#include <string.h>
int main (int argc, char **argv) {
/* how to mount a MED file with a mesh and a MED file with a field in a
root MED file */
med_idt fid;
/* file creation */
fid = MEDfileOpen("UsesCase_MEDfile_1.med",MED_ACC_CREAT);
if (fid < 0) {
MESSAGE("ERROR : file creation");
return -1;
}
/* comment writing */
if (MEDfileCommentWr(fid,"A root MED file") < 0) {
MESSAGE("ERROR : file comment writing");
return -1;
}
/* file closing */
if (MEDfileClose(fid) < 0) {
MESSAGE("ERROR : file closing");
return -1;
}
return 0;
}
MEDfileOpen
MEDC_EXPORT med_idt MEDfileOpen(const char *const filename, const med_access_mode accessmode)
Ouverture d'un fichier MED.
Definition: MEDfileOpen.c:42
med_idt
hid_t med_idt
Definition: med.h:331
MEDfileCommentWr
MEDC_EXPORT med_err MEDfileCommentWr(const med_idt fid, const char *const comment)
Ecriture d'un descripteur dans un fichier MED.
Definition: MEDfileCommentWr.c:34
MESSAGE
#define MESSAGE(chaine)
Definition: med_utils.h:324
med.h
MED_ACC_CREAT
Definition: med.h:123
MEDfileClose
MEDC_EXPORT med_err MEDfileClose(med_idt fid)
Fermeture d'un fichier MED.
Definition: MEDfileClose.c:30
main
int main(int argc, char **argv)
Definition: 3.0.8/test10.c:50
med_utils.h