Nvidia CUDA coding issue

I am new to CUDA coding but i am having some issues, in the CUDA decoder example for H.264 that of DecoderD3D9 the output frame is shown using a CUDA device Pointer, can anybody help me out here and guide me as to how i can save every output frame as a png file. I tried to save the frame as a BYTE* array but could not save it.