48 lines
844 B
Markdown
48 lines
844 B
Markdown
# binary_address_book
|
|
|
|
binary address book from text manipulation chapter
|
|
|
|
# Address Book Fields
|
|
Things to store
|
|
1. First name(s)
|
|
2. Last name
|
|
3. Street Address
|
|
4. City
|
|
5. State/Province
|
|
6. Post Code
|
|
7. Phone Number
|
|
8. Extra
|
|
|
|
There can be any number of extras
|
|
|
|
# Binary Format
|
|
|
|
The binary format for the address book starts with a DB Header. Immediately following the DB Header is the first record header. Each record header is followed by the number of field headers indicated by the field count.
|
|
|
|
## DB Header
|
|
|
|
1. Magic 0xDB
|
|
2. u4 major
|
|
3. u4 minor version
|
|
4. u16 reserved
|
|
3. u32 record count
|
|
|
|
## Record Header
|
|
|
|
1. u8 field count
|
|
2. u8 length - not including header
|
|
3. u16 crc16-arc - not including header
|
|
|
|
022094A6
|
|
|
|
## Field
|
|
Hex
|
|
0100034a6f6e020006fa616e78a656e
|
|
```
|
|
Field 1 - First Name(s)
|
|
Length 3
|
|
Jon
|
|
Field 2 - Last Name
|
|
Length 6
|
|
Janzen
|
|
``` |