MEDfichierOuvrir.c
Aller à la documentation de ce fichier.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 #include <med.h>
00020 #include <med_config.h>
00021 #include <med_outils.h>
00022 #include <hdf5.h>
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032  
00033 med_idt _MEDfichierOuvrir(char *nom,med_mode_acces mode)
00034 { 
00035   med_idt fid;
00036   int hdf_mode;
00037 
00038   switch(mode)
00039     {
00040     case MED_LECTURE_ECRITURE :
00041     case MED_LECTURE_AJOUT    :
00042       hdf_mode = H5F_ACC_RDWR; 
00043       break;
00044 
00045     case MED_LECTURE :
00046       hdf_mode = H5F_ACC_RDONLY;
00047       break;
00048 
00049     default :
00050       MESSAGE("Le mode d'accès demandé pour le fichier :");
00051       SSCRUTE(nom);
00052       MESSAGE("n'est pas compris");
00053       return -1;
00054     }  
00055 
00056   if ((fid = H5Fopen(nom,hdf_mode,H5P_DEFAULT)) < 0) {
00057     MESSAGE("Impossible d'ouvrir le fichier :");
00058     SSCRUTE(nom);
00059     MESSAGE("en mode :");
00060     ISCRUTE_int(mode);
00061     return -1;
00062   }
00063 
00064   _MEDsetModeAcces(fid,mode);
00065 
00066   return fid;
00067 }