Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!apple!agate!e260-1g.berkeley.edu!c60b-1eq From: c60b-1eq@e260-1g.berkeley.edu (Noam Mendelson) Newsgroups: comp.lang.c Subject: Re: Little problem with sizeof on PC Message-ID: <1991Apr24.032428.18207@agate.berkeley.edu> Date: 24 Apr 91 03:24:28 GMT References: <1991Apr23.022057.29511@ux1.cso.uiuc.edu> <1991Apr23.132612.16687@msuinfo.cl.msu.edu> <1991Apr23.155042.5532@ux1.cso.uiuc.edu> Sender: root@agate.berkeley.edu (Charlie Root) Organization: University of California, Berkeley Lines: 20 In article <1991Apr23.155042.5532@ux1.cso.uiuc.edu> allender@cso.uiuc.edu (Mark Allender) writes: >Just a followup to me problem with the word alignment in this structure.. >The data that I am reading in someone else's form, and has to stay this way. >I can't change it. And indeed, I would rather have the data in raw binary >form. There is a filler byte inserted after the filler2[15] declaration. >The best suggestion around this was to read the entire 201 bytes into >a char buffer[201] array, and then memcpy the elements into their corresponding >location. How about reading the struct in two steps, first reading everything up to the end of filler2[] (not including the byte padding), then reading the rest into the float number? That would be much more efficient (memory- and speed-wise) than that e-mail suggestion. -- +==========================================================================+ | Noam Mendelson ..!ucbvax!web!c60b-1eq | "I haven't lost my mind, | | c60b-1eq@web.Berkeley.EDU | it's backed up on tape | | University of California at Berkeley | somewhere." |