Path: utzoo!attcan!uunet!husc6!ukma!rutgers!mit-eddie!uw-beaver!microsoft!markro From: markro@microsoft.UUCP (Mark Roberts) Newsgroups: comp.lang.c Subject: Re: MSC5.1: bug in realloc() ??? Message-ID: <1168@microsoft.UUCP> Date: 5 Nov 88 00:20:48 GMT References: <2310001@hprnd.HP.COM> Reply-To: markro@microsoft.UUCP (Mark Roberts) Organization: Microsoft Corp., Redmond WA Lines: 20 In article <2310001@hprnd.HP.COM> pyt@hprnd.HP.COM (Pierre-Yves Thoulon) writes: |I've recently had trouble with the realloc function in the Microsoft C v5.1 | |struct FileInfo |{ | char Dummy0; /* so the unsigned be correctly aligned on word boudary */ | char Attrib; | ... | char Name[13]; | char Dummy1; /* so next structure in array will be on word boundary */ |}; | memcpy(&Files[FileNum++].Attrib,&DosReturn.attrib,sizeof(struct FileInfo)); I suggest the problem is with your code sample. You are copying sizeof(struct FileInfo) but that includes your two Dummy chars. How about (sizeof(FileInfo)-2) or (sizeof(FileInfo)-2*sizeof(char)) if you want to be REAL portable. Glad to be of help.