use memmove() instead of array subscripting in getdata()