perhaps i'm stupid, or just inexperienced, but what could i do to stop this from happening? The data in this field will range from 3-20 characters long, so i just said 20 would be good. I don't mind if it has spaces after it, but i can't have random data, since the data is being parsed into another program i'm more familiar with.
"Sebastian Voges" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > On Fri, 06 Jun 2003 15:52:46 -0500, Matt Andreko wrote: > > > > > ok, i've seen my mistakes there, and the application is running fine, no > > crashes. > > However, do you see any reason why in my data, there would be random letters > > placed there? i'm looking at the data when i'm pulling it off into a text > > file (this program is known to work already), and when reading it right off > > the palm using SyncWizard it has a 'p' and a 'DA' in it. > > > > The program that pulls it out has it come like: > > 123456789 987654321 p 147258369 DA > > > > any ideas? > > > > Hi Matt, > > I don't know how you read out the data, consider the following > from your code: > > typedef struct { > char Department[20]; > char Operator[20]; > char RXNumber[20]; > } DBRecord; > DBRecordType r; > // fill the record with data > StrCopy(r.Department, "123456"); > StrCopy(r.Operator, "987654321"); > StrCopy(r.RXNumber, "147258369"); > > > > you then write this structure out to the record. > > The data you write will look like this: > > 123456\0 followed by 13 bytes of unknown content > 987654321\0 followed by 10 bytes of unknown content > 147258369\0 followed by 10 bytes of unknown content" > > My point here is that the structure you allocate is 20 bytes for each > item. You fill out the structure, but there are still unused spaces ( e.g. > "1234567" only uses up 7 bytes of the 20 bytes allocation) > > Also you don't zero out the structure after creating it, so there will be > random data in it. > so when you read in the data,you probably see the random data after your > strings. > > I hope that helps, > > Sebastian > > > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
