The fact that you say "the out of system calls" leads me to believe that you're using the system() function (from stdlib.h) to run commands.
Is that correct?
Assuming it is, you aren't really writing a shell, you're writing a program that runs on top of a shell. To do what a shell does you'll use fork() and exec() and pull the output from stdout/stderr directly instead of using system() to tell bash (or whatever) to run the command for you.
Using system() you have to redirect the output to a file and then read that file.
So, if you want to get the output of the ls command you do
- system("ls > /tmp/ls.output");
and then open the ls.output file and read the content.
There are many other ways to do it, but you didn't explain much about the architecture of your program or your goals.