Forums Register Login

Calculating OffSet

+Pie Number of slices to send: Send
Hello Guys, I am confuse about calculating Offset Values.

For the first record.. it should be

the header ... but for the 2nd and next...

do use

1) headersize + (a record size * currentRecordNo) + deleteflag(1)

or

2) headersize + (a record size * (currentRecordNo)) + currentRecordNo;

it seems the 2nd way works.. I don't understand why must i add the current record count and not + 1 for delete flag.
+Pie Number of slices to send: Send
Maybe it is just working because your deleted flag is 1. If it was 2 I guess your 2nd formula would not work at all.

I would expect something like: headerSize + ((record length + deleted flag) * recNo)
+Pie Number of slices to send: Send
same here.. I would also expect that + 1 for delete flag(but it didn't work all the words are jumble up)... BUT the 2nd formula works!!! I don't know why.. can some guru explain to me~??~
+Pie Number of slices to send: Send
Please notice the difference in my formula against your 1st formula! They give complete different results!
+Pie Number of slices to send: Send
 

Roel De Nijs wrote:Please notice the difference in my formula against your 1st formula! They give complete different results!



oh!! pardon me, I haven't been sleeping much for days.. and still stuck @ database layer..

Thanks once again
+Pie Number of slices to send: Send
I'd suggest opening the file with a Hex Editor and starting comparing the schema to the file contents. Then everything will be clear. This thread here should help you to understand the schema and read the data file.
I'm gonna teach you a lesson! Start by looking at this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 800 times.
Similar Threads
getBytes() urgent ????????
Andrew book persistDvd method ERROR?
Printing two substrings
[URLyBird] Should I use a business object or String[] in my Data class?
B & S: stuck on calculating offset for updateRecord()
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 16:49:03.