Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* "byte sex" or "endian" conversion program
@ 1993-10-02 21:25 Greg Sandell
  1993-10-03 14:56 ` Charles M Richmond
  1993-10-04 16:24 ` Steve Lionel
  0 siblings, 2 replies; 6+ messages in thread
From: Greg Sandell @ 1993-10-02 21:25 UTC (permalink / raw)


I work across several platforms including one DEC and several non-DEC 
machines.  The DEC represents binary differently than all the others.
(I suppose this isn't news to many people who read this bboard!)  I've
been told that the difference between standards is merely a swapping of
the upper and lower signficant portions of the value.  However, when
I've tried my own conversion programs (reading in a binary value then
writing it out swapped) they don't work.  There must be something I
don't know.

For example, if I had a loop to read in binary floats:

        char data[4], out[4];
        while (read(0,data,4) != 0) {

...I had thought that doing the following was the right thing:

	out[0] = data[2] ; out[1] = data[3];
	out[2] = data[0]; out[3] = data[1]
        write(1,out,4);
	
If this is wrong, can someone show me the right way?

Thanks in advance.  Email replies appreciated, as I don't typically read
this bboard.

Greg
--
Gregory J. Sandell  (sandell@epunix.sussex.ac.uk)
Experimental Psychology, University of Sussex
Brighton BN1 9QG England  +44-273-678058


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1993-10-09  1:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1993-10-02 21:25 "byte sex" or "endian" conversion program Greg Sandell
1993-10-03 14:56 ` Charles M Richmond
1993-10-04  4:33   ` Thad P Floryan
1993-10-04 16:24 ` Steve Lionel
1993-10-08 20:33   ` Kevin Ferguson
1993-10-09  1:49     ` fairfield

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox