This Code is work fine. I have made program for weigh bridge in which I have to use control c for calibration so if I press control c then program will automatically exit to avoid these I have used above mentioned code thank you very much