nvs::NVSHandle::get_string() method
get value for given key These functions retrieve the data of an entry, given its key. If key does not exist, or the requested variable type doesn't match the type which was used when setting a value, an error is returned. In case of any error, out_value is not modified. Both functions expect out_value to be a pointer to an already allocated variable of the given type. It is suggested that nvs_get/set_str is used for zero-terminated short C strings, and nvs_get/set_blob is used for arbitrary data structures and long C strings.
Arguments
key
Key name. Maximum length is (NVS_KEY_NAME_MAX_SIZE-1) characters. Shouldn't be empty.
len
The length of the output buffer pointed to by out_str/out_blob. Use \c get_item_size to query the size of the item beforehand.
Return value
- ESP_OK if the value was retrieved successfully - ESP_ERR_NVS_NOT_FOUND if the requested key doesn't exist - ESP_ERR_NVS_INVALID_NAME if key name doesn't satisfy constraints - ESP_ERR_NVS_INVALID_LENGTH if length is not sufficient to store data
nvs::NVSHandle::get_string() overrides 2 methodss:
![]()
nvs::NVSHandle::get_string()