MemSet will set a range of memory to a specific value. To allocate memory,
you should use MemPtrNew (x) or MemHandleNew (x), where x is the amount of
memory, in bytes, that you want. x should be of type unsigned long.
Regards,
Steve
-----Original Message-----
From: Michael Sendrove [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 11, 2000 12:02 AM
To: Palm Developer Forum
Cc: Palm Developer Forum
Subject: RE: Record-writing problem.
I don't thinkI allocated space for it at all! Should I use MemSet()?
Cheers,
Mike.
-----Original Message-----
From: Jim Schram [mailto:[EMAIL PROTECTED]]
Sent: 10 March 2000 11:24
To: Michael Sendrove
Cc: Palm Developer Forum
Subject: Re: Record-writing problem.
At 6:09 PM -0800 2000/03/10, Michael Sendrove wrote:
>I'm writing an application that collects data from the serial port and
>creates a CSV list. My problem is this:
>I use the loop at the end of this message to write the value into the
>record. It seems to go OK but looking at the database (using a database
>viewer during hotsync), it contains nonsense.
I'm a bit confused by your intention here:
voltage = SysRandom(0);
StrIToA(voltagetxt, voltage);
DmWrite(recordp, i*sizeof(voltage), &voltagetxt, sizeof(voltage)/8);
You're writing sizeof(voltage)/8 bytes, which is zero unless voltage is a
double long. And you've just converted voltage to voltagetxt which is a C
string, so I assume you're trying to write the string representation of
voltage to the record, not the integer representation. If so, use
StrLen(voltagetxt) not sizeof(voltage) for the last parameter, and
recalculate the DmWrite index parameter appropriately. Or, if you're trying
to write the integer value to the record, pass &voltage to DmWrite, not
&voltagetxt. On a related note, did you allocate space for voltagetxt on the
stack or in the heap?
Regards,
Jim Schram
Palm Incorporated
Partner Engineering
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palm.com/devzone/mailinglists.html
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html