C99 – Advance Function (Part-1) , in c language in hindi , abort() , exit() , quick exit() , EXIT_ SUCCESS

abort() , exit() , quick exit() , EXIT_ SUCCESS , C99 – Advance Function (Part-1) , in c language in hindi :-
c 99 मे हमने कई सारे मॉडिफिकेशन को पढ़ा जैसे नये data type , array और function के declartion मे changes ,header files |लेकिन इस सभी मॉडिफिकेशन के बाद C99 मे  special function को introduce किया गया है | जिससे प्रोग्राम को running control easy किया जा सकता है |
ये function है :
1. abort()
इस function का use प्रोग्राम को सुद्देंली termination के लिए किया जाता है |जब hadler को SIGBRT को assign कर सकते और इस command को signal मे pass करता है तब इस function का use किया जाता है |
इस function का use file को open और क्लोज करने के लिए किया जाता है |जब कोई file open और क्लोज होने command को denie कर देती है तब ये function perform हो सकता है |
इस function मे कोई भी argumnet pass नहीं होता है और कोई भी value return नहीं होती है |
इसका उदाहरण है :
#include<stdio.h>
#include<conio.h>
void main()
{
FILE *f;
f=fopen(“Data.doc”,”w”);
if(f==NULL)
{
printf(“File can not open .”);
abort();
}
else
{
puts(e);
}
fclose(f);
getch();
}
इस उदाहरण मे , file ‘Data.doc’ को open किया जाता है|अगर file उपलब्ध नहीं होती है तब file pointer ‘f’ की value NULL होती है |और  File can not open . message होता है इसके साथ abort() function से प्रोग्राम terminate हो जाता है |
आउटपुट होगा :
 File can not open .
2. exit()
इस function का use प्रोग्राम को sudden termination के लिए किया जाता है |लेकिन इसमें प्रोग्राम के termination के साथ कई और clean up प्रोसेस perform होते है :
1.जिस function को exit() मे pass कियुआ जाता है use reverse order मे call किया जाता है |
2.सभी c streams क्लोज हो जाती है |
3.सभी temperory file भी क्लोज हो जाती है |
4.program का control environment पर आ जाता है |
अगर exit() function मे ‘0’ को pass किया जाता है तब प्रोग्राम के successful execution को define किया जाता है और इसके अलावा ‘1’ ,प्रोग्राम के unsuccessful execution को define करता है |
इस function मे exit_code को pass किया जाता है exit_code प्रोग्राम के execution  status को देफिंस करता है | कोईभी value return नहीं होती है |
इसका उदहारण है :
 इसका उदाहरण है :
#include<stdio.h>
#include<conio.h>
void main()
{
FILE *f;
f=fopen(“Data.doc”,”w”);
if(f==NULL)
{
printf(“File can not open .”);
exit(1);
}
else
{
puts(e);
}
fclose(f);
getch();
}
इस उदाहरण मे , file ‘Data.doc’ को open किया जाता है|अगर file उपलब्ध नहीं होती है तब file pointer ‘f’ की value NULL होती है |और  File can not open . message होता है इसके साथ exit() function से प्रोग्राम terminate हो जाता है |और exit code ‘1’ , प्रोग्राम के unsuccessful एक्षेकुतिओन को define करता है |
 function quick_exit() से associate होता है क्योकि जब प्रोग्राम मे exit () function को call किया जाता है तब कोम्प्लिएर मे exit() और quick exit() function मे confusion हो जाता है |
3. quick exit()
इस function का use , किसी प्रोग्राम के sudden termination के लिए किया जाता है लेकिन इसमें clean up process नहीं होता है |और quick exit को reverse order मे call किया जाता है |इसका मतलब है जो quick exit call सबसे बस मे होगे वो सबसे पहले execute होगा |
इसका उदाहरण है :-
 #include<stdio.h>
#include<conio.h>
void add(int ,int );
void  sub (int int);
void main()
{
int a ,b ;
printf(“enter data  “);
scanf(“%d %d “, &a &b);
quick_exit(add(a ,b));
quick_exit(sub(a ,b));
getch();
}
void add(int c, int d)
{
int sum= c+d;
printf(“Sum = %d”, sum);
}
void add(int c, int d)
{
int diff= c-d;
printf(“Difference = %d”, diff);
}
इस उदाहरण मे , दो quick exit function को call किया गया है |जिसमे मे से difference वाला function पहले perform होता है |आउटपुट होगा :
enter data 43 33
Difference = 10
Sum = 77

4. EXIT_ SUCCESS
EXIT_ SUCCESS : ये macro है जो की function के success status को define करता है |
EXIT_ FAILURE : ये macro है जो की किसी function के failure status को define करता है |
इसका उदाहरण है :-

#include<stdio.h>
#include<conio.h>
void main()
{
FILE *f;
f=fopen(“Data.doc”,”w”);
if(f==NULL)
{
printf(“File can not open .”);
exit(EXIT_ FAILURE);
}
else
{
puts(e);
}
fclose(f);
return(EXIT_ SUCCESS );
}
5. at_quick_exit()
इस function का use किसी function को call करके terminate किया जाता है |इसमें function को return किया जाता है और ‘0’ return होता है अगर function call होता है अन्यथा ‘1’ return होता है |
6. atexit()
इस function का use किसी function को call करके terminate किया जाता है |इसमें function को return किया जाता है और ‘0’ return होता है अगर function call होता है अन्यथा ‘1’ return होता है |