My conduit is in java and my handheld program is in C. I have had no 
problems reading packed records which contain strings but integers are all 
zero when I fetch them. I am wondering if my unpack routine hasa problem? I 
can't see one though. My handheld C code looks like:


static void UnpackRange(RangePtr range, const PackedRange
                            *packedRange)
{
    const char *s = packedRange->name;

    itemRange->name = s;
    s += StrLen(s) + 1;
    packedRange->startRange = (Int32)*s;
    s = s + 4;
    packedRange->endRange = (Int32)*s;
   //I read the name fine but StartRange and endRange are always
//zero when I unpack them this way though I know I am
//writing legitimate numbers on the java side.
}

The Range structures are:

typedef struct Range {
    const char *name;
    Int32 startRange;
        Int32 endRange;
} Range;

typedef struct PackedRange {
    const char name[1];
} PackedRange;

on the java side in the conduit I do:

public void readData(java.io.DataInputStream in)
                       throws java.io.IOException
  {
        itemRangeName = AbstractRecord.readCString(in);
        startRange = in.readInt();
        endRange = in.readInt();
  }

public void writeData(java.io.DataOutputStream out)
                        throws java.io.IOException
{
        if (itemRangeName == null)
                itemRangeName = "";

        AbstractRecord.writeCString(out,itemRangeName.trim());
        out.writeInt(startRange);
        out.writeInt(endRange);
}

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to