Thank you both very much for your help!

With void* and some typecasting it works fine now.