After I do an update to the database file, I read it again and print it out. Before my update, when I print results of name field, it looks fine (i.e. no weird characters at the end). However, after my update, I get weird characters at the end. These weird characters do not show up in Notepad, but do show up when I use the Programmers File Editor tool. Updates for all my fields work fine with the exception of the weird characters at the end. (i.e. I am not just off by a few bytes for each field.) When I read the initial file and print out an unused ending byte from one of the string fields, it prints out as 0. Also, when I print out the 1st element of my "just initialized" fully padded byte array below, that also shows up as 0. So I thought I would be in synch. Note that my specs say data is "null terminated if less than the maximum length for the field". Here is my pseudo code for the update:
Do I need to explicitly pad the fullyPaddedByteArray above with something for null? If so, what character sequence represents null for a primitive byte? Any help appreciated. Thanks. TJ
Do you think the space approach would lose marks though, since my spec says: "... data is "null terminated if less than the maximum length for the field". Space approach sounds reasonable, but I'd hate lose points (or even worse auto fail) because of it. Thoughts??? TJ
Joined: Nov 07, 2003
Since I cannot find the "MUST" keyword in that paragraph, I guess the null terminated requirement is not stictly enforced.