Thursday, February 2, 2012

Core Dump - Check for core dump

 /* core_dumpV1 */  
 // header files  
 #include<unistd.h>  
 #include<stdio.h>  
 //main func  
 void main(int argc,char *argv[])  
 {  
      int i,pid,exitstat,status,j=0;  
      pid=fork();  
      if(pid==0)  
      {  
           i=10/j;  
      }  
      else  
      {  
           wait(&status);  
           if(status&80)  
                printf("our core dumped\n");  
           else  
            printf("core dumped my foot\n");  
      }  
 }  

No comments:

Post a Comment