[GRASS-dev] Re: ctypes problem with Vect_open_old

Martin Landa landa.martin at gmail.com
Tue Jan 4 11:09:58 EST 2011


Hi,

2011/1/4 Glynn Clements <glynn at gclements.plus.com>:
>> p = line_pnts()
>> Vect_append_point(byref(p), 1, 1, 0)
>
> You're passing an uninitialised line_pnts structure (i.e. with its
> fields containing garbage), and probably trashing the heap. Use
> Vect_new_line_struct() to allocate an empty line_pnts object.

something like?

map_obj = Map_info()
map = pointer(map_obj)

Vect_open_update(map, "a", "")

p = Vect_new_line_struct()
c = Vect_new_cats_struct()

Vect_append_point(p, 1, 1, 0)
Vect_cat_set(c, 1, 1)
print p.contents.n_points

Vect_write_line(map, GV_POINT, p, c)

Vect_build(map)
Vect_close(map)

No success, btw

p = line_pns()
Vect_append_point(byref(p), 1, 1, 0)
print p.n_points

interestingly works.

Martin

-- 
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa


More information about the grass-dev mailing list