Hi @usyber ,
Yes you are on the right track, you can take inspiration from this example in the documentation here.
Also I posted an example last year here which may also be useful as a reference. Just beware there is a typo in the code the malloc(i_pnt);
statements should be malloc(i_pnt+1);
!
Kind Regards,
Pete