cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/28/06:54:00

From: jsc AT lds DOT co DOT uk
Newsgroups: comp.os.msdos.djgpp
Subject: Forming a float from 4 seperate bytes
Date: Tue, 27 Jul 1999 18:37:16 GMT
Organization: Deja.com - Share what you know. Learn what you don't.
Lines: 25
Message-ID: <7nku8s$hkl$1@nnrp1.deja.com>
NNTP-Posting-Host: 194.73.88.189
X-Article-Creation-Date: Tue Jul 27 18:37:16 1999 GMT
X-Http-User-Agent: Mozilla/2.0 (compatible; MSIE 3.0; Windows 95)
X-Http-Proxy: 1.0 x21.deja.com:80 (Squid/1.1.22) for client 194.73.88.189
X-MyDeja-Info: XMYDJUIDbillynomates
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello all, sorry for the post that isn't specifically related to DJGPP, but
it's the only C news group I'm on.

I'm writing an (old) 3DStudio4 file parser and found a problem in the way
that the vertex coordinates are listed. each floating point value is
represented by 4 bytes which I can access but can't combine to form the
original float.

Well, I sort of can. If I do it directly from the file and use

fread (&Xvalue,4,1,fp);

where fp is my file pointer, 4 = the sizeof(float) , 1 = I want to do this
once and Xvalue = the final float value I want to end up with, it works. I
don't know why - I just took it from a doc on the 3ds format. However I want
to unload the file to a buffer and then start parsing. I've done the reading
into the buffer, but now I don't know how to reform my float from the data, I
tried  taking the 4 values and &-ing them together, but that doesn't work as
the final value I'm after is a float and I get an operand error. Any ideas on
how to take 4 integers and form the float? I'm surre it's easy but I can't
get it to work. Thanks Chris  jsc AT lds DOT co DOT uk


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019