Message-Id: <376F083001E72A00@iris.ernet.in> Date: 11 Dec 96 15:15 IST From: tehmul%NIITPUN AT iris DOT ernet DOT in Sender: tehmul%niitpun AT iris DOT ernet DOT in To: djgpp AT delorie DOT com Subject: Date: 11-Dec-96 15:15 Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit John M. Flinchbaugh wrote: > my c program says that the size of that record is 224 bytes, while the > quickbasic program is using it as a 218-byte record. obviously, this won't > due if the c program is to read the files written by the old quickbasic > program. > i suspect it has something to do with going from 16-bit dos to 32-bit > linux and the data alignment involved in storing records. You suspect right. > what is the easiest way to correct this problem in the c program, for > the data files have already been written, and i need to read them from c > for conversion? You need to specify an attribute called packed with your structure. This is unique to DJGPP. Change your code so that it reads like this: typedef struct { : : //Details omitted } __attribute__((packed)) sheet_s; I tried this out on my machine and compiled and got the same size as your quickbasic thingy (218 bytes). BTW there's also another way to align data on specific byte boundaries (an attribute called align), its there in the gcc docs. HTH. Ciao TG