Printing a cl_mem object


i would like to examined the contents of a cl_mem object. Right now i cast it into an unsigned char* and use printf to display the contents in hex format .However i have a feeling that this approach may be incorrect. Does anyone have alternative suggestions? Thanks

If you are talking about a buffer, you have to enqueue a read to that buffer and place the content in an array on host.