Created
January 4, 2012 04:37
-
-
Save blackball/1558533 to your computer and use it in GitHub Desktop.
example for vpack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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