From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,20ac8f08b884ba5 X-Google-Attributes: gid111c93,public X-Google-Thread: 1094ba,10f7c56bf397ed71 X-Google-Attributes: gid1094ba,public X-Google-Thread: 103885,20ac8f08b884ba5 X-Google-Attributes: gid103885,public From: Toon Moene Subject: Re: Forcing 32-bit integers and math Date: 1998/10/15 Message-ID: <705kpm$4rq$1@newnews.nl.uu.net>#1/1 X-Deja-AN: 401461203 References: <6vt65k$5hp$1@walter-fddi.cray.com> <701flh$njg$1@news.kjist.ac.kr> Organization: Moene Computational Physics, Maartensdijk, The Netherlands Newsgroups: comp.lang.fortran,comp.graphics.visualization,comp.os.linux.alpha "G. Hugh SONG" wrote: > open(Uout, file = 'i2.dt', form='unformatted') > write(Uout) i2 > close(Uout) ... > open(Uout, file = 'r8.dt', form='unformatted') > write(Uout) r8 > close(Uout) > stop > end > Then, I created two executables, test.ix for intel and test.ax for alpha. > The file sizes of the output files after running test.ix are > -rw------- 1 ghsong faculty 28 Oct 14 11:47 i4.dt > -rw------- 1 ghsong faculty 28 Oct 14 11:47 id.dt > -rw------- 1 ghsong faculty 48 Oct 14 11:47 r8.dt > -rw------- 1 ghsong faculty 28 Oct 14 12:21 rd.dt > -rw------- 1 ghsong faculty 18 Oct 14 11:47 i2.dt > After running test.ax, they are > -rw------- 1 ghsong faculty 36 Oct 14 11:35 i4.dt > -rw------- 1 ghsong faculty 36 Oct 14 11:35 id.dt > -rw------- 1 ghsong faculty 56 Oct 14 11:35 r8.dt > -rw------- 1 ghsong faculty 36 Oct 14 12:18 rd.dt > -rw------- 1 ghsong faculty 26 Oct 14 11:35 i2.dt > This result implies that the two output "record" files are > significantly different. Indeed they are - the Alpha unformatted records have two 64-bit record length specifiers, whereas the Intel ones use 32-bit specifiers. Note that the Fortran Standard doesn't guarantee you anything about the possibility of reading unformatted files on one system that were written on another; therefore the records in them and their sizes do not necessarily have to agree. For this sort of exchange, use formatted I/O or a portable "binary" format like HDF. Hope this helps, -- Toon Moene (mailto:toon@moene.indiv.nluug.nl) Saturnushof 14, 3738 XG Maartensdijk, The Netherlands Phone: +31 346 214290; Fax: +31 346 214286 g77 Support: mailto:fortran@gnu.org; egcs: mailto:egcs-bugs@cygnus.com