I am using exec in following way.

execl("/usr/bin/cksum","/usr/bin/cksum",rfile,(char*)NULL))


But I want to store the output in file. Like I can do on command line (
cksum filename > tempfile). How can I do this using exec.