I am writing a conduit that creates a file on an expansion card. I am running into a strange problem where it seems like the function VFSFileWrite behaves strangely depending on the number of bytes that you attempt to write. It appears to be a word boundary issue, but I cannot determine which boundaries are "good" or "bad" in order to figure out a work-around. Below is a structure that represents a single record to be written to the expansion card file:
typedef struct { char sku[20]; UINT32 price; UINT32 descriptionLength; UINT32 descriptionOffset; } SkuInfoExpansionCardRecordType; Here is a code excerpt that shows a single record being written to the card: UINT32 numBytesWritten; SkuInfoExpansionCardRecordType skuInfoRec; UINT32 recordSize = sizeof(SkuInfoExpansionCardRecordType); // populate skuInfoRec with appropriate data result = VFSFileWrite(skuInfoFileRef, recordSize, &skuInfoRec, &numBytesWritten); This results in 32 bytes of garbage being written to the expansion file. After this garbage, the record is correctly written. If I change the structure to the following: typedef struct { char sku[kSkuLength]; UINT32 price; UINT32 descriptionLength; UINT32 descriptionOffset; UINT32 unused; } SkuInfoExpansionCardRecordType; then everything works fine. So, for writing single records, this is an adequate work-around. The problem is that I have to create very large expansion card files and it is not efficient to write each record individually. I write some number of records to a buffer and then write the buffer to the card. However, this buffering makes it much harder to predict when word-boundary issues are going to cause problems. Has anyone seen this problem before and what was your solution. Thank you in advance. Gabe Black Forall Systems, Inc. Chicago, IL -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/