I think you left out the code that actually writes these structs to file... that might help us identify the problem. Brian On 12/26/05, Dale Walsh <websrvr@xxxxxxxxxxxxxxxxxx> wrote: > I'm trying to generate data files however it seems to be prepending > 244 bytes of data and I can't see how to prevent this. > > The actual data files are very large and manually using a hex editor > to generate them isn't appealing considering there are about 300 of > them. > > > > Here is my test compile session with a reduced file with 2 rows of 10 > bytes so the file should be 32 bytes in length. > > test.c: (combined header and source) > ___________________________ > > typedef struct > { > /* # of entries in data */ > int entries; > /* entry size and count */ > int size; > int cnt; > /* data; array of bytes, one row after another. */ > char *data; > } > gFast; > > /* Location functions take these. */ > typedef gFast * gFastPtr; > > char TestDATA[20]; > > gFast gFastTestRep = { > 2, > 2, > 10, > TestDATA > }; > > gFastPtr gFastTest = &gFastTestRep; > /* > this is all the data > the file should be 32 bytes in length > 20 bytes of data and 12 bytes for header > */ > > char TestDATA[] = { > > /* Entry 000 */ > 1,2,3,4,5,6,7,8,9,10, > > /* Entry 001 */ > 11,12,13,14,15,16,17,18,19,20, > }; > > ___________________________ > > > compiled with: > gcc -pipe -static -c -o test.out test.c > > ___________________________ > > > Here's the resulting file content, there are always 244 leading bytes > of data that I can't have, the stuff appended to the end would also > be nice to not have however it wont interfere with the file being > valid to the application and isn't as critical. > > mustangrestomods:/temp2/clamav-0.80 root# hexdump -vC test.out > 00000000 fe ed fa ce 00 00 00 12 00 00 00 00 00 00 00 01 > |................| > 00000010 00 00 00 02 00 00 00 d8 00 00 20 00 00 00 00 01 > |.......... .....| > 00000020 00 00 00 c0 00 00 00 00 00 00 00 00 00 00 00 00 > |................| > 00000030 00 00 00 00 00 00 00 00 00 00 00 28 00 00 00 f4 > |...........(....| > 00000040 00 00 00 28 00 00 00 07 00 00 00 07 00 00 00 02 |... > (............| > 00000050 00 00 00 00 5f 5f 74 65 78 74 00 00 00 00 00 00 > |....__text......| > 00000060 00 00 00 00 5f 5f 54 45 58 54 00 00 00 00 00 00 > |....__TEXT......| > 00000070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f4 > |................| > 00000080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > |................| > 00000090 00 00 00 00 00 00 00 00 5f 5f 64 61 74 61 00 00 > |........__data..| > 000000a0 00 00 00 00 00 00 00 00 5f 5f 44 41 54 41 00 00 > |........__DATA..| > 000000b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 28 > |...............(| > 000000c0 00 00 00 f4 00 00 00 02 00 00 01 1c 00 00 00 02 > |................| > 000000d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 > |................| > 000000e0 00 00 00 18 00 00 01 2c 00 00 00 03 00 00 01 50 > |.......,.......P| > 000000f0 00 00 00 24 00 00 00 02 00 00 00 02 00 00 00 0a |... > $............| > 00000100 00 00 00 14 00 00 00 00 01 02 03 04 05 06 07 08 > |................| > 00000110 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 00 00 00 10 > |................| > 00000120 00 00 02 40 00 00 00 0c 00 00 02 40 00 00 00 0f > |...@.......@....| > 00000130 0f 02 00 00 00 00 00 14 00 00 00 19 0f 02 00 00 > |................| > 00000140 00 00 00 10 00 00 00 01 0f 02 00 00 00 00 00 00 > |................| > 00000150 00 5f 67 46 61 73 74 54 65 73 74 52 65 70 00 5f > |._gFastTestRep._| > 00000160 54 65 73 74 44 41 54 41 00 5f 67 46 61 73 74 54 | > TestDATA._gFastT| > 00000170 65 73 74 00 |est.| > 00000174 > > > > > -- Dale > >