• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

0xFF implies deleted record

 
jesal dosa
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all I hope you can help,

I am doing URLyBird 1.3.3 project using the following db-1x3.db database

I really do not understand this statement in the project.

1 byte flag. 00 implies valid record, 0xFF implies deleted record

i am searching for this flag using a test file i have created. i use the following code in a while loop to search each record in the file



the result brings back each record as 0
doing a byte x = (byte) 0xFF means x is equal to -1
I could not seem to find any -1 ones in my database does this mean there are no deleted records in the database i received from sun?

or am i missing something obvious and my logic is flawed

i hope you guys can help
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi jesal,

my db-file did not have any records that were marked as 'deleted', but why don't you use and hex-editor like UltraEdit and have a look?

Herman
 
jesal dosa
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Herman.

Should have used this tool a long time ago would have helped me understand things a lot quicker. From the looks of it i do not have any deleted records.

i have alot of '20' which represent the empty spaces. i used the trim functionality to remove this from my string.
Just wanted to confirm and make sure these '20' represent a blank space?

Once again thanks for your help
 
Tomasz Wilk
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not quite shure should it be -1...
byte is ofcourse 8 bits and is signed so casting 0xFF on it will result in
having -1. But basically 0xFF means all bits as "1". That would be -128.
I am using this value in my assignment.
Should I used -1?
 
Tomasz Wilk
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, ignore my previous reply... I was wrong, you are right
 
Xabier Martija
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Once I had the same problem.
You are reading a byte, but you should read unsigned byte:


OR ...

You could use other comparation. This will work even if you read as a signedByte :


Instead of

[ October 21, 2007: Message edited by: Xabier Martija ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic