Message-Id: <199908132341.TAA08734@delorie.com> From: "Dan Gold" To: Subject: Re: From Bytes to Int and Char Date: Sat, 13 Aug 1994 02:10:29 -0700 X-MSMail-Priority: Normal X-Priority: 3 X-Mailer: Microsoft Internet Mail 4.70.1155 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com ---------- > From: Campbell, Rolf [SKY:1U32:EXCH] > To: djgpp AT delorie DOT com > Subject: Re: From Bytes to Int and Char > Date: Friday, August 13, 1999 11:41 AM > > Nick wrote: > > > I am trying to load some data from a files, the 6 and 7th bytes are an > > Integer and so are the 11th and 12th. How do I make them into an INT? This > > is what I used earlier > > > > char ver, type; > > int sz, tz; > > > > sz = file_buffer[6] + file_buffer[7]; > > is that right? > > No. Here's the right way to do it. This code is not edian safe. > > sz = *(short*)(file_buffer+6); // Shouldn't it be *(int)(file_buffer+6) Dan Gold..