Skip to content

Instantly share code, notes, and snippets.

@blackball
Created January 4, 2012 04:37
Show Gist options
  • Save blackball/1558533 to your computer and use it in GitHub Desktop.
Save blackball/1558533 to your computer and use it in GitHub Desktop.
example for vpack
#include "vpack.h"
#include <stdio.h>
struct Model
{
char c;
int pts[4];
float vec[1024];
};
int main(int argc, char *argv[])
{
struct Model model = {0};
/* fill model */
if (vpack("model.b", "ci#f#", &(model.c), model->pts, 4, model->vec, 1024))
{
fprintf(stderr, "Error: some error ocurs while saving model.\n");
return -1;
}
/* when you need to use model above */
if (vget("model.b", "ci#f#", &(model.c), model->pts, 4, model->vec, 1024))
{
fprintf(stderr, "Error: some error ocurs while reading model.\n");
return -1;
}
/* use model */
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment