It's entirely different by OS. Some won't allow you to do it at all, and you have to have some means of knowing where the data you want is in the target's memory space.

Here's how to do it on Linux:
http://unix.stackexchange.com/questions/6301/how-do-i-read-from-proc-pid-mem-under-linux