MED fichier
f/test1.f
1 C* This file is part of MED.
2 C*
3 C* COPYRIGHT (C) 1999 - 2016 EDF R&D, CEA/DEN
4 C* MED is free software: you can redistribute it and/or modify
5 C* it under the terms of the GNU Lesser General Public License as published by
6 C* the Free Software Foundation, either version 3 of the License, or
7 C* (at your option) any later version.
8 C*
9 C* MED is distributed in the hope that it will be useful,
10 C* but WITHOUT ANY WARRANTY; without even the implied warranty of
11 C* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 C* GNU Lesser General Public License for more details.
13 C*
14 C* You should have received a copy of the GNU Lesser General Public License
15 C* along with MED. If not, see <http://www.gnu.org/licenses/>.
16 C*
17 
18 C******************************************************************************
19 C * - Description : open/close med files
20 C *
21 C *****************************************************************************
22  program test1
23 C
24  implicit none
25  include 'med.hf'
26 C
27 C
28  integer cret
29  integer fid
30  character*255 fname
31  character*200 des
32  parameter(des = "Ceci est un courte description"
33  1 // " du fichier test1.med")
34 
35 C Creation du fichier "test1.med"
36  call mfiope(fid,'test1.med',med_acc_rdwr, cret)
37  print *,cret
38  if (cret .ne. 0 ) then
39  print *,'Erreur à la création du fichier'
40  call efexit(-1)
41  endif
42 
43 C Ecriture d'un en-tete dans le fichier
44  call mficow(fid,des,cret)
45  print *,cret
46  if (cret .ne. 0 ) then
47  print *,'Erreur à ecriture en-tete'
48  call efexit(-1)
49  endif
50 
51 C Lecture de la taille du nom de fichier "test1.med"
52  call mfinam(fid,"", cret)
53  print *,cret
54  if (cret .le. 0 ) then
55  print *,'Erreur à la lecture de la taille du nom de fichier'
56  call efexit(-1)
57  endif
58 
59 C Lecture du nom de fichier "test1.med"
60  call mfinam(fid,fname, cret)
61  print *,cret
62  if (cret .le. 0 ) then
63  print *,'Erreur à la lecture du nom de fichier'
64  call efexit(-1)
65  endif
66  print *,fname
67 
68 C Fermeture du fichier
69  call mficlo(fid,cret)
70  print *,cret
71  if (cret .ne. 0 ) then
72  print *,'Erreur à la fermeture du fichier'
73  call efexit(-1)
74  endif
75 
76 C Re-ouverture du fichier en lecture seule
77  call mfiope(fid,'test1.med',med_acc_rdonly, cret)
78  print *,cret
79  if (cret .ne. 0 ) then
80  print *,'Erreur ouverture du fichier en lecture'
81  call efexit(-1)
82  endif
83 
84 C Fermeture du fichier
85  call mficlo(fid,cret)
86  print *,cret
87  if (cret .ne. 0 ) then
88  print *,'Erreur à la fermeture du fichier'
89  call efexit(-1)
90  endif
91 
92  end