I am doing some file IO with c code. I have a particular pattern in my file. I can verify this by a shell command cat abc.txt | grep abc | wc -l. When I execute
cat abc.txt | grep abc | wc -l
You don't want system(3) for that. Try popen(3) and friends.
system(3)
popen(3)