It took this, and it works: err = DmWrite(p, OffsetOf(TransStructType, BasekVA),&Record->BasekVA, sizeof(Record->BasekVA));
----- Original Message ----- From: "Del Ventruella" <[EMAIL PROTECTED]> To: "Palm Developer Forum" <[email protected]> Sent: Tuesday, November 08, 2005 8:51 AM Subject: Re: DmSet > Thanks for the recommendation. > > I tried: > > err = DmWrite(p, OffsetOf(TransStructType, BasekVA),Record->BasekVA, > sizeof(Record->BasekVA)); > > and the compliler is not pleased. > > The error generated asserts a conversion from an unsigned short to a > constant void pointer. > > > ----- Original Message ----- > From: "Ben Combee" <[EMAIL PROTECTED]> > To: "Palm Developer Forum" <[email protected]> > Sent: Monday, November 07, 2005 8:20 PM > Subject: Re: DmSet > > > > At 04:37 PM 11/7/2005, you wrote: > > >I am trying to modify a database record. The element of the record is > > >derived from the corresponding structure, in which it is designated as > > >"UInt16" data type. Now I try to use DmSet to write, and have a problem > > >with "UInt8" data type being required for DmSet. > > > > > >My code line reads as: > > > > > >err = DmSet (p, OffsetOf(TransStructType, > > >BasekVA),sizeof(Record->BasekVA), Record->BasekVA); > > > > > > > > >This does not cause a crash or a compiler complaint. It simply does not > > >put the number on the screen that I want. I've been using StrAtoI and > > >StrItoA to read and write to fields, and these return 32 bit > > >integers. This hasn't presented any problem, until I try to write an 8 > > >bit integer to a sixteen bit "chunk". The value that comes back when I > > >write the value to the screen is not the one that I enter. The > conversion > > >process is clearly getting in the way. > > > > > >Is there another API call to write to an integer in a record that permits > > >one to write to a 16 bit integer? > > > > DmSet is the same api as MemSet, but for database memory. To write an > > 16-bit integer, use DmWrite, taking the address of a Int16 variable that > > you've saved the value into, and passing the size of that variable in as > well. > > > > > > -- Ben Combee, Senior Software Engineer, Palm, Inc. > > "Combee on Palm OS" weblog: http://palmos.combee.net/ > > Developer Forum Archives: http://news.palmos.com/read/all_forums/ > > > > > > -- > > For information on using the PalmSource Developer Forums, or to > unsubscribe, please see http://www.palmos.com/dev/support/forums/ > > > > -- > For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/ > -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
