JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

हिंदी माध्यम नोट्स

Categories: C Language in hindi

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 होता है |
Sbistudy

Recent Posts

सती रासो किसकी रचना है , sati raso ke rachnakar kaun hai in hindi , सती रासो के लेखक कौन है

सती रासो के लेखक कौन है सती रासो किसकी रचना है , sati raso ke…

16 hours ago

मारवाड़ रा परगना री विगत किसकी रचना है , marwar ra pargana ri vigat ke lekhak kaun the

marwar ra pargana ri vigat ke lekhak kaun the मारवाड़ रा परगना री विगत किसकी…

16 hours ago

राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए sources of rajasthan history in hindi

sources of rajasthan history in hindi राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए…

2 days ago

गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है ? gurjaratra pradesh in rajasthan in hindi

gurjaratra pradesh in rajasthan in hindi गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है…

2 days ago

Weston Standard Cell in hindi वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन

वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन Weston Standard Cell in…

3 months ago

polity notes pdf in hindi for upsc prelims and mains exam , SSC , RAS political science hindi medium handwritten

get all types and chapters polity notes pdf in hindi for upsc , SSC ,…

3 months ago
All Rights ReservedView Non-AMP Version
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings
JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now