Hi,
The problem occurs exactly in the line (READ(1, END=5, ERR=7) strTitle).
I added the "ERR=7", the crash doesn't appear but I could understand that the program ignores the error (the output file, unit 2, is not written).
I am sorry for all these questions, but I made so many tests with different selaphin files and different OPEN and READ options, but it doesn't work.
I would like to mention that I wrote a binary file with Fortran containing a 80 characters string, the code works without problems.
Here is the code correction, following your advises :
PROGRAM ReadSelaphin
CHARACTER(LEN=80) :: strTitle
OPEN(1, FILE="C:\TELEMAC\Sta2.ref", FORM="UNFORMATTED")
OPEN(2, FILE="C:\TELEMAC\Sta2.txt", FORM="FORMATTED")
READ(1, END=5, ERR=7) strTitle
WRITE(2,*) strTitle
5 CLOSE(1)
6 CLOSE(2)
7 CONTINUE
STOP
END
Kind Regards
Fezai