BMessage message; message.AddInt8("count", 4); int8_t count; if (message.FindInt8("count", &count) == B_OK) { // use count variable }
BMessage message; message.AddInt32("id", 1); int8_t id; if (message.FindInt8("id", &id) == B_NAME_NOT_FOUND) { // handle error }In this example, a BMessage object is created and a 32-bit integer value of 1 is added with the key "id". Then the FindInt8 function is called to retrieve the value associated with the "id" key. Since the key "id" does not exist as an 8-bit integer value, the function returns B_NAME_NOT_FOUND. Overall, the BMessage FindInt8 function is a convenient way to retrieve 8-bit integer values from a BMessage object.