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

Reply via email to