Article # 277, added by Geoworks, historical record
| first |
previous |
index |
next |
last |
DB item gets last two bytes stomped on.
Q. I'm having trouble retrieving the data that I have placed into the default record when I create the database. When I am retrieving the data later, each piece of data has had its last two bytes stomped on, usually with two bytes containing 0xCC. Each item has the following format: typedef struct { unsigned short size; char data[1]; } DBField; where size is the size of the data, and data is the address of the first byte of the data. A. You are not allocating the correct size for the items. The size needs to include the word of data that gives the size of the db item. (In other words, add sizeof( word ) to the db item size.) For problems like this, you can gather more information by using the various LMem related EC flags in Swat ('help ec' in Swat for more information). Those flags will enable various extra internal error checking and may well give more insight as to what's happening.