I've done some more experimenting and the problem is purely just a problem of passing the pointer to the function. If I use a global variable to pass the data or paste the contents of the function into the main code then it works.

any further suggestions ?

@Gál Zsolt

--nooverlay caused the while loop at the end not to be executed and the rest of the options had no noticeable effect on the program

Jason White