C*************************************************************************
C COPYRIGHT (C) 1999 - 2003  EDF R&D
C THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
C IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE 
C AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION; 
C EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
C
C THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
C WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
C MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
C LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
C
C YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
C ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
C INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
C
C**************************************************************************

C******************************************************************************
C * - Nom du fichier : test1.f
C *
C * - Description : exemples d'ouverture/fermeture de fichiers MED 
C *
C *****************************************************************************
      program test1
C     
      implicit none
      include 'med.hf'
C
C     
      integer cret
      integer fid
      character*200 des
      parameter (des = "Ceci est un courte description"
     1     // " du fichier test1.med")  
      
C     Creation du fichier "test1.med"
      call efouvr(fid,'test1.med',MED_CREATION, cret)
      print *,cret

C     Ecriture d'un en-tete dans le fichier
      if (cret .eq. 0) then
         call effide (fid,des,cret)
      endif
      print *,cret
      
C     Fermeture du fichier
      call efferm (fid,cret)
      print *,cret

C     Re-ouverture du fichier en lecture seule      
      call efouvr(fid,'test1.med',MED_LECTURE, cret)
      print *,cret

C     Fermeture du fichier
      call efferm (fid,cret)
      print *,cret

      end
