Can someone help me on my code, I am new to METIS. thanks

I made a code in VS2010 to test the API of METIS. It can be built but can not run. Can someone give me some help on it? It is a finite element mesh problem. I include the 'metis.h' and the 'metis.lib'. I assume it is a beam element model. I can run it by the stand-alone program.

(7) ------------- (8)
| |
| |
| |
| |
(5) ------------- (6)
| |
| |
| |
| |
(3) ------------- (4)
| |
| |
| |
| |
(1) (2)

e.g. "(1)" refers to node 1; the dash refers to beam elements.

Here is the code:
extern "C" {
int METIS_PartMeshNodal(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind, idx_t *vwgt, idx_t *vsize,
idx_t *nparts, real_t *tpwgts, idx_t *options, idx_t *objval, idx_t *epart, idx_t *npart);
}

int _tmain(int argc, _TCHAR* argv[])
{
int i;
idx_t n_e = 9, *ne = &n_e;
idx_t n_n = 8, *nn = &n_n;
idx_t v_eptr[10] = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18};
idx_t *eptr = v_eptr;
idx_t v_eind[18] = {1, 3,
2, 4,
3, 5,
4, 6,
5, 7,
6, 8,
3, 4,
5, 6,
7, 8};
idx_t *eind = v_eind;
idx_t n_parts = 2, *nparts = &n_parts;
idx_t v_objval = 0, *objval = &v_objval, *epart, *npart;
epart = new idx_t[*ne];
npart = new idx_t[*nn];
i = METIS_PartMeshNodal(ne, nn, eptr, eind, NULL, NULL, nparts, NULL, NULL, objval, epart, npart);
for (i = 0; i <= *ne; i++) {
cout <<"ele: " <

RE: I changed the idx_t

I changed the idx_t v_eind[18] to =
idx_t v_eind[18] = {0, 2,
1, 3,
2, 4,
3, 5,
4, 6,
5, 7,
2, 3,
4, 5,
6, 7};
Looks like it is working. That is wierd, because when I use the stand-alone program, the
{1, 3,
2, 4,
3, 5,
4, 6,
5, 7,
6, 8,
3, 4,
5, 6,
7, 8};
works fine.

RE: The numbering style (I.e., if

The numbering style (I.e., if it starts from 0 or 1) is controlled by the numbering options parameter. The default for the numbering is to start from 0.

RE: Yes, I got this problem

Yes, I got this problem before.

RE: the plot of the model

Sorry, above picture does not work.

(7)-(8)
|***|
(5)-(6)
|***|
(3)-(4)
|***|
(1)*(2)

* just represent blank