Hi ach001,
I have done it long time ago.
You just need to use the pointers (as Ben said) and calculate the block
lengths. The main issue you will find is that any of the blocks is
optional (app, sort, records), so you must take care of how calculate
them.

You can try something like this:

1. Calculate PDB file length = FileLen

2. Create an array recOffset to store the records list. Include one more
element to store FileLen, ie, if you have 10 records, create an array of
11 elements. Populate it with the offsets in the record list.

3. Calculate app and sort blocks size and adjust some pointers.

4. Some Logic:
If numRecords = 0 then recOffset[1] = FileLen
If sortInfo = 0 then sortInfo = recOffset[1]
If appInfo = 0 then appInfo = recOffset[1]

appInfoSize = sortInfo - appInfo
sortInfoSize = recOffset[1] - sortInfo

For x = 1 to numRecords
   'Read each record as a chunk size
   recSize = recOffset[x+1] - recOffset[x] 'Chunk size

   'Or read each field
   'Move the pointer to recOffset[x]
   'Read each field value according to field type
Next

Thats all!

Hope it helps
Oscar


> No, you use the pointers in the PDB header to find the offset to the
> start of the first record.
>
> On 4/12/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> hi, i hope this is the right forum and i really hope someone can help.
>> from the documentation:
>>
>> IMPORTANT: There is always a gap between the final record list in the
>> header and the first block of data in the database, where the first
>> block might be one of the following: the appInfo block, the sortInfo
>> block, raw record or resource data, or the end of the file. The gap is
>> traditionally two bytes long; however, if you write code to parse a
>> database, your code should be able to handle any size gap, from zero
>> bytes long and up.
>>
>> How do i determine how long this gap will be?  Or do you just seek to
>> the end of the header, then readByte until you hit a non-zero value?
>>
>> (i'm trying to write a PC program to convert PDB to CVS.  i know there
>> are lots out there already, but i'd like to merge this functionality
>> into another another program i'd like to write)
>> --
>> 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/

Reply via email to