From: Nate Eldredge Newsgroups: comp.os.msdos.djgpp Subject: Re: binary to float Date: 24 Feb 2000 13:40:08 -0800 Organization: InterWorld Communications Lines: 29 Message-ID: <83k8ju1dqf.fsf@mercury.st.hmc.edu> References: NNTP-Posting-Host: mercury.st.hmc.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: nntp1.interworld.net 951428538 33477 134.173.45.219 (24 Feb 2000 21:42:18 GMT) X-Complaints-To: usenet AT nntp1 DOT interworld DOT net NNTP-Posting-Date: 24 Feb 2000 21:42:18 GMT User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii writes: > On Thu, 24 Feb 2000, Dieter Buerssner wrote: > > > unsigned long l; > > float x; > > fread(&l, sizeof l, 1, fp); > > l = ntohl(l); > > x = *(float *)&l; > > > > My question, is this really more portable? In the libc info for ntohl > > under Portability I read: not ANSI, not POSIX. Is this function > > generally available? > > I've seen them on every Unix box I had access to. > > > Also, one other problem might arise when > > unsigned long is 64bit (i.e. Alpha, which uses IEEE floating point). > > I don't have access to an Alpha to check. Anybody? I do, but the original test program has been snipped, and I'm not entirely sure from context what it was testing. Someone care to send it to me? -- Nate Eldredge neldredge AT hmc DOT edu