Wednesday, May 18, 2022

graphresult() Function & grapherrormsg() Function C programming in HINDI-trendhacking

जैसाकि इसके पहले blog post में हम देख चुके है की initgraph function जिसे हम graphics driver का initailize/ load करते है और system text mode से graphical mode में change हो जाता है जब हम ghaphics driver को intailize करते है और graphics driver intailize ना हो तो हमें check करना चाहिए की ghaphics driver successfuly load हो पाया की नहीं यदि नहीं तो क्या error है यह error को message screen पर print करना तो इसके लिए जो दो Fuction होते है आज इस ब्लॉग पोस्ट में रीड करेंगे 

  • graphresult function 
  • graphresult function c c++ in hindi 
  • grapherrormsg function c c++ programming language  in hindi

graphresult function c language hindi

दोस्तों यह fuctionएक error code return करता है जो graphics के list unsuccessful ऑपरेशन का error code return करता है error code वह code होता है जिससे पता चलता है की ग्राफ़िक्स से रिलेटेड कौन से error आई है

 graphresult (): यह एक Graphics function है जो मान 0 देता है यदि ग्राफिक्स सही ढंग से load होता है और drivers  को ग्राफिक्स मोड सही ढंग से start  किया गया है अन्यथा यह 0 से अलग कुछ error code returen करता  है। 

अगर system programming के दौरान कोई error है तो उस return करता है यदि कोइ error नहीं है यदि error नहीं होता है तो (grOK) पर set  रहता है 

error code figure 1.1 में दिया गया है और उस error code का क्या मतलब है Example error कोड -1 का मतलब graphics install नहीं है -2  का मतलब Graphics hardware detect नहीं कर रह है आदि 

syntax :-

               int far graphresult(void);


grapherrormsg function C programming hindi 

grapherrormsg() function graphics.h header file में define है जो error message को string में देता है जो भी error measegge है उसके लिए pointer return करता है और इसको जरूत होती है उस integer value को यानि उस errorcode की जो graphresult function के द्वारा return किया गया हैऔर उस error code से releate जो भी string होता है वह grapherrormsg() function द्वारा return होता है

आप ऊपर figures में error code व string देख सकते है  

Declaration:             char *grapherrormsg( int errorcode );


closegraph function c\c++ hindi

Closegraph function graphic system को shut down कर देता है. यह graphics system से allocate सभी space जो memory reseve करता है वह space fee कर देता है 

syntax:- closegraph();

graphresult function c programming example hindi 

 #include<graphics.h>

#include<conio.h>

#include<stdio.h>

#include<stdlib.h>

int main(void)

{

\*request auto detection*\

int graph=DETECT , gmode ,error;

int xmax , ymax;

\*initialize graphics and local variables *\

initgraph(&graph , &gmode ,"c:\\turboc3\\bgi");

\*read result of initialize *\

error = ghaphicsresult();

/* an error occurredy *\

if ( error!=grOK)

{

printf("Graphics error : %s \n",grapherrormsg(error));

printf("press any key to halt :");

getch();

exit(1);

}

/* draw a line */

line(0,0,getmaxx(),getmaxy());

getch();

closegraph();

}

code explain 

ऊपर दिए गए  प्रोग्राम में हमने gd = DETECT नहीं लिखा है।इस program को चलाने के बाद हमें output मिलता है:-graphics error: graphicsहार्डवेयर का पता नहीं चला बाहर निकलने के लिए कोई भी कुंजी बाएँ।

यदि pragram में कोई error नहीं मिलता है तो line function reun हो और line draw हो जाए