It's pretty hard to figure out what you really want. You seem to fundamentally misunderstand what fmemopen does.