MED fichier
f/2.3.6/test1.f
1 C* This file is part of MED.
2 C*
3 C* COPYRIGHT (C) 1999 - 2017 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 * - Nom du fichier : test1.f
20 C *
21 C * - Description : exemples d'ouverture/fermeture de fichiers MED
22 C *
23 C *****************************************************************************
24  program test1
25 C
26  implicit none
27  include 'med.hf'
28 C
29 C
30  integer cret
31  integer*8 fid
32  character*200 des
33  parameter(des = "Ceci est un courte description"
34  1 // " du fichier test1.med")
35 
36 C Creation du fichier "test1.med"
37  call efouvr(fid,'test1.med',med_lecture_ecriture, cret)
38  print *,cret
39  if (cret .ne. 0 ) then
40  print *,'Erreur à la création du fichier'
41  call efexit(-1)
42  endif
43 
44 C Ecriture d'un en-tete dans le fichier
45  call effide (fid,des,cret)
46  print *,cret
47  if (cret .ne. 0 ) then
48  print *,'Erreur à ecriture en-tete'
49  call efexit(-1)
50  endif
51 
52 C Fermeture du fichier
53  call efferm (fid,cret)
54  print *,cret
55  if (cret .ne. 0 ) then
56  print *,'Erreur à la fermeture du fichier'
57  call efexit(-1)
58  endif
59 
60 C Re-ouverture du fichier en lecture seule
61  call efouvr(fid,'test1.med',med_lecture, cret)
62  print *,cret
63  if (cret .ne. 0 ) then
64  print *,'Erreur ouverture du fichier en lecture'
65  call efexit(-1)
66  endif
67 
68 C Fermeture du fichier
69  call efferm (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  end