how to delay a process from getting killed

We are forking a process B from process A and the process B should display the details it reads from process C(daemon process) continuously.
Let us say that the process C sents 100 packets.The process B receives all the 100 packets from the process C before it prints all details of 31 packets.Since the process B recieved all the 100 packets it gets killed.
If we press ctrl-c(sends SIGINT signal) after the receival of 31 packets i.e, after the process B got killed.the process A also gets killed & it is not displaying the remaining packets since the buffer gets cleared.Can anyone help me to know how to delay the process A or process B from being killed before it displays all the 100 packets.

Thanks in Advance,
Megala.C

First, I don't think you want to "Delay" the process from being killed. You merely want to call fflush() after every output. (Are you using buffered I/O, ie, printf? Or are you using write() to print? Probably the former, so you need fflush(STDOUT)).

What kills process B? Is it your ctrl-C/SIGINT?

Now to your actual question:
You can install a signal handler for SIGINT so that it does the normal thing after a small delay. For instance, one way to do this would be to have something like a signal handler that calls exit():

#include <signal.h>
void
sighandler(int thesignal) {
  signal(SIGINT,SIG_IGN);
  sleep(3);
  exit(2);
}

main() { 
 .... somehwere ...
 signal(SIGINT, sighandler);
 ... main code...
}