Skip to content

Commit

Permalink
c get/put example update
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind committed Jul 15, 2020
1 parent 6784dd6 commit 953bc7e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions c-api-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ int main(int argc, char* args[]) {

{ // Create
Task task = {.text = "Buy milk"};
id = Task_put(store, &task);
id = Task_put(box, &task);
if (!id) goto handle_error;
printf("New task inserted with ID %d\n", id);
}

{ // Read
task = Task_get(store, id);
task = Task_get(box, id);
if (!task) goto handle_error;
printf("Task %d read with text: %s\n", id, task->text);
}
Expand All @@ -85,7 +85,7 @@ int main(int argc, char* args[]) {
}
memcpy(new_text + old_text_len, appendix, strlen(appendix) + 1);
task->text = new_text;
if (!Task_put(store, task)) goto handle_error;
if (!Task_put(box, task)) goto handle_error;
printf("Updated task %d with a new text: %s\n", id, task->text);
}

Expand Down

0 comments on commit 953bc7e

Please sign in to comment.