Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site lamont.UUCP Path: utzoo!linus!philabs!lamont!rbd From: rbd@lamont.UUCP (Roger Davis) Newsgroups: net.lang.f77,net.unix-wizards Subject: binary i/o problem Message-ID: <136@lamont.UUCP> Date: Tue, 7-May-85 15:39:26 EDT Article-I.D.: lamont.136 Posted: Tue May 7 15:39:26 1985 Date-Received: Fri, 10-May-85 07:49:52 EDT Distribution: net Organization: Lamont-Doherty Geological Observatory, Palisades, NY Lines: 45 Xref: linus net.lang.f77:221 net.unix-wizards:10269 Does anyone know how to get a Fortran program to read a binary file through standard input? (Or why it's not possible, if such is the case?) The following test program, and an infinite number of variations thereon, will not work, while a similar program that reads formatted input through standard input works fine. % cat rdbinary.f c program rdbinary c c read binary input from stdin c integer number c close(5) open(5, status='old', form='unformatted', err=80) write(6, '("stdin opened")') c read(5, err=90) number write(6, '("number = ", i5)') number goto 100 c c error messages 80 write(6, '("open error")') goto 100 90 write(6, '("read error")') goto 100 c 100 stop end This program produces the following output when supplied with a binary input: % rdbinary