i know you can change file descriptors to point to others, which i think would be what your looking for. hopefully youve done some pipe programming and other UNIX system programming, if so you should be able to figure it out without too much effort.
check
man dup2. what this system call does is change one file descriptor (for example stderr) to point to another one. so what you can do is create your own file descriptor (or pipe i think) and set the output of stderr to go to your new fd (or pipe, i forget sorry!). once you have access to the file descriptor integer value, you can read it just like a normal file.
hope thats what your looking for