Skip to content

Commit

Permalink
Make sure example matches current example code.
Browse files Browse the repository at this point in the history
  • Loading branch information
woodsmc committed Nov 14, 2020
1 parent 5c0793f commit 4e40978
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ More detailed documentation can be found at the following locations:

static const char* const FILENAME = "test.store";
static const char* const STRING_TO_SAVE = "Hey, this is an example string to store!";
static const TOStoreObjID ID = 42;

int main(int argc, const char* argv[]) {
TOStoreHnd store = NULL;
Expand All @@ -72,10 +73,14 @@ int main(int argc, const char* argv[]) {
return error;
}
const uint32_t size = strlen(STRING_TO_SAVE) + 1; // null terminator
error = ostore_addObjectWithId(store, STRING_TO_SAVE, size);
error = ostore_addObjectWithId(store, ID, size);
if ( error != ERR_OK) {
printf("there was an error saving the object %d", error);

} else {
error = ostore_write(store, ID, 0, STRING_TO_SAVE, size);
if ( error != ERR_OK ) {
printf("there was an error writing to the store %d", error);
}
}
ostore_close(&store);
printf("String saved in the test store\n");
Expand Down

0 comments on commit 4e40978

Please sign in to comment.