The tust comunity library tust (not created by me) has a nice functions that are doing all the work for you.
Look for DynamicModel.c/.h .
You can create a Model, than add all vertices and then create a model instance. It supports filesaving too, but only *.x meshs.