home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!haven.umd.edu!decuac!pa.dec.com!rdg.dec.com!news.crl.dec.com!dbased.nuo.dec.com!e2big.mko.dec.com!quark.enet.dec.com!lionel
- From: lionel@quark.enet.dec.com (Steve Lionel)
- Subject: Re: swapping bytes on a two byte integer
- Message-ID: <1992Dec15.172455.12204@e2big.mko.dec.com>
- Lines: 24
- Sender: usenet@e2big.mko.dec.com (Mr. USENET)
- Reply-To: lionel@quark.enet.dec.com (Steve Lionel)
- Organization: Digital Equipment Corporation, Nashua NH
- References: <BzB6rI.LI7@acsu.buffalo.edu>
- Date: Tue, 15 Dec 1992 17:24:55 GMT
-
-
- In article <BzB6rI.LI7@acsu.buffalo.edu>, acscmaw@ubvmsb.cc.buffalo.edu
- (MARK WIECZOREK) writes:
- |>
- |>I have a very simple problem. I have a binary data file composed of two byte
- |>integers. After reading the data I would like to change the order of the
- |>bytes and write the result to a file. I've looked through the vax fortran
- |>manuals and couldn't find a way to do this. Any help would be greatly
- |>appreciated.
- |>
-
- The simplest way is to use ISHFTC(value,8,16). If you have a lot of these to
- do and want something faster, you can define the variable as a record structure
- with two byte elements and swap the bytes yourself.
-
- The next major release of Fortran for OpenVMS VAX will have a feature that will
- do the byte-swapping for you on input or output, if selected.
- --
-
- Steve Lionel lionel@quark.enet.dec.com
- SDT Languages Group
- Digital Equipment Corporation
- 110 Spit Brook Road
- Nashua, NH 03062
-