02.05.2014 Views

Patrick Corde & Anne Fouilloux

Patrick Corde & Anne Fouilloux

Patrick Corde & Anne Fouilloux

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Fichier binaire séquentiel 97<br />

7.2.1 – Fichier binaire séquentiel<br />

On appelle fichier binaire un fichier dans lequel on<br />

stocke les informations telles qu’elles sont représentées<br />

en mémoire.<br />

C’est au moment de l’ouverture du fichier que l’on<br />

indique le type de fichier à traîter.<br />

real, dimension(100) :: tab<br />

integer<br />

:: i<br />

real<br />

:: r<br />

integer<br />

:: ios<br />

OPEN( UNIT=1,<br />

&<br />

FILE="data_bin_seq", &<br />

FORM="unformatted", &<br />

ACCESS="sequential", &<br />

ACTION="read", &<br />

POSITION="rewind", &<br />

IOSTAT=ios )<br />

if ( ios /= 0 ) stop "Problème à l’ouverture"<br />

READ( UNIT=1, IOSTAT=ios ) tab, i, r<br />

do while ( ios == 0 )<br />

...<br />

READ( UNIT=1, IOSTAT=ios ) tab, i, r<br />

end do<br />

CLOSE( UNIT=1 )<br />

INSTITUT DU DÉVELOPPEMENT<br />

ET DES RESSOURCES<br />

EN INFORMATIQUE SCIENTIFIQUE<br />

Cours langage Fortran – 27 janvier 2006<br />

<strong>Patrick</strong> <strong>Corde</strong> et <strong>Anne</strong> <strong>Fouilloux</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!