This is an example of how to create and open a database.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wiredtiger.h>
static const char *home;
int
main(void)
{
int ret;
if (getenv("WIREDTIGER_HOME") == NULL) {
home = "WT_HOME";
ret = system("rm -rf WT_HOME && mkdir WT_HOME");
} else
home = NULL;
fprintf(stderr, "Error connecting to %s: %s\n",
return (EXIT_FAILURE);
}
if ((ret = conn->
open_session(conn, NULL, NULL, &session)) != 0) {
fprintf(stderr, "Error opening a session on %s: %s\n",
return (EXIT_FAILURE);
}
if ((ret = conn->
close(conn, NULL)) != 0) {
fprintf(stderr, "Error closing %s: %s\n",
return (EXIT_FAILURE);
}
return (EXIT_SUCCESS);
}