Have a look at mplsamp2.c in the examples directory of the source distribution, I believe it does what you want, you just have to change the hardcoded names appropriately to your application.
GLPK comes with a nice manual, 3.2 Routines for processing MathProg models details how to deal with MathProg models using the C API.