Replaced fmemopen (not supported by mingw :/) with pointer arithmetic