
gcvt

㭪            ८ࠧ ᫮  饩 窮  ᨬ
                   ப.

⠪          #include <stdlib.h>
                   char * gcvt(double value, int ndig, char *buf);

, ᮤঠ騩   stdlib.h
⨯

ᠭ           gcvt ८ࠧ  value    ப  ᨬ  
                   ASCII,  ࠭祭 㫥,    ப  
                   buf.  ᫨ ,    砥 ndig 
                      ଠ  F  ࠭.    ⨢  砥
                   ப  㤥   ଠ E 㭪樨 printf ( ࠧ
                      ).        
                   㫨.

頥       gcvt 頥  ப.
祭

७ᨬ      gvct ন ⥬ UNIX.   ।-
                     ⠭ ANSI C,  ⮬   ४-
                   㥬 ᯮ짮   ७ᨬ ணࠬ.

 ⠪     ecvt, fcvt, sprintf.

ਬ:

#include<stdlib.h>
#include<stdio.h>

int main(void)
{
   char str[25];
   double num;
   sig = 5;

   num = 9.876;
   gcvt(num,sig,str);
   printf("ப = %s\n",str);
   num = -123.45;
   gcvt(num,sig,str);
   printf("ப = %s\n",str);
   num = 0.6789e5;
   gcvt(num,sig,str);
   printf("ப = %s\n",str);
   return 0;
}


geninterrupt

㭪             ணࠬ 뢠.

⠪          #include <dos.h>
                   void geninterrupt(int intr_num);

, ᮤঠ騩   dos.h
⨯

ᠭ            ப 뢠 ணࠬ 뢠 
                   ஬,    ।塞    intr_num.    ﭨ
                   ॣ஢  ᫥  맮  뢠     
                   ணࠬ ࠡ⪨ ⮣ 뢠.

                   뢠   ॣ, ᯮ㥬 
                   ,  ।᪠㥬 ﭨ.

頥       .
祭

७ᨬ      geninterrupt 㭨쭠  8086.

 ⠪     bdos, bdosptr, disable, enable, getvect, int86,
                   int86x, intdos, intdosx, intr.

ਬ:

#include<conio.h>
#include<dos.h>

void writechar(char ch);

int main(void)
{
   clrscr();
   gotoxy(80,25);
   writechar("*");
   getch();
   return 0;
}
/* 뢮 ᨬ  ⥪   */
/* ᯮ짮 㭪樨 BIOS  ப⪨ ࠭ */
/*  뢮   80,25 */

void writechar(char ch)
{
   struct text_info ti;
   gettextinfo(&ti);  /*  ⥪騥 ⠭ */
   _AH = 9;  /* 뢠 10H, 㭪 9 */
   _AL = ch; /* 뢮 ᨬ */
   _BH = 0;  /* ࠭ */
   _BL = ti.attribute /* ਡ */
   _CX = 1;  /* 䠪 ७ */
   geninterrupt(0x10); /* 뢮 ᨬ */
}


getarccoords

㭪            뤠 न ᫥ 饭  㭪樨
                   arc.

⠪          #include <graphics.h>
                   void far getarccoords(struct arccoordstype
                                          far *arccoords);

, ᮤঠ騩   graphics.h
⨯

ᠭ           getarccoords   arccoords-  type,
                       㪠뢠  arccoords,  ଠ樥  
                   ᫥  맮  arc.      arccordstype
                   ।  graphics.h ᫥騬 ࠧ:

                   struct arccoordstype{
                          int x, y;
                          int xstart, ystart, xend, yend;
                       };

                    ⮩         ᯮ    
                   ।   業   (x,y),砫쭮    (xstart,
                   ystart)    筮  (xend,yend) 権 㣨.
                   祭   ᯮ짮 ᫨ 室 ,
                   ⮡  ᥪ   㣨.

頥       .
祭

७ᨬ      㭪 㭨쭠    Borland C++.   ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨ ०.   㭪      ᮢ⨬   
                   Windows.

 ⠪     arc, fillellipse, sector.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
struct srccoordstype arcinfo;
int midx,midy;
int stangle = 45,endangle = 270;
char sstr[80],estr[80];

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
midx = getmaxx() / 2;
midy = getmaxy() / 2;
setcolor(getmaxcolor(1));

/*   */
arc(midx,midy,stangle,endangle,100);
getarccoords((&arcinfo);

/* ८ࠧ ଠ樨  ப */
sprintf(sstr,"*- (%d, %d)",arcinfo.xstart,arcinfo.ystart);
sprintf(sstr,"*- (%d, %d)",arcinfo.xend,arcinfo.yend);
/* 뢥 ଠ  ࠭ */
outtextxy(arcinfo.xstart,arcinfo.ystart,estr);
outtextxy(arcinfo.xend,arcinfo.xend,estr);

/* ⪠ */
getch();
closegraph();
return 0;
}


getaspectratio

㭪            頥 ⥪饥   ࠪ᪮  ⭮襭
                   (⭮襭  ਭ  ࠦ        )
                   ᪮ ०.

⠪          #include <graphics.h>
                   void far getaspectratio( int far *xasp,
                                             int far *yasp);

, ᮤঠ騩   graphics.h
⨯

ᠭ            y-ᯥ,  *yasp,  ଠ  10 000;
                     ᪨ ,  ஬ VGA, *xasp (
                   䠪 y-ᯥ)  *yasp, .. ᥫ 
                    ,  祬  ਭ.    VGA,    
                   "" ᥫ,  *xasp ࠢ *yasp.   楫,
                   ᮮ⭮襭  *yasp  *xasp ᫥饥:

                            *yasp = 10000
                            *xasp <= 10000

                   getaspectratio । 祭  *xasp  *yasp.

頥       .
祭

७ᨬ          㭪       Turbo  Pascal.
                   㭪  ᮢ⨬  Windows.

 ⠪     arc, circle, ellipse, fillellipse, pie-
                   slices, sector, setaspectratio.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
int xasp,yasp,midx,midy;

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
midx = getmaxx() / 2;
midy = getmaxy() / 2;
setcolor(getmaxcolor(1));

/*  ⥪饥 ࠪ᪮ ⭮襭 */
getaspectratio(&xasp,&yasp);

/* ᮢ ଠ 㦭 */
circle(midx,midy,100);
getch();

/* ᮢ 㦭,   ਭ */
cleardevice();
setaspectratio(xasp/2,yasp);
circle(midx,midy,100);
getch();

/* ᮢ 㦭,    */
cleardevice();
setaspectratio(xasp,yasp/2);
circle(midx,midy,100);
getch();

/* ⪠ */
getch();
closegraph();
return 0;
}


getbkcolor

㭪            頥 ⥪騩 梥 䮭.

⠪          #include <graphics.h>
                   int far getbkcolor(void);

, ᮤঠ騩   graphics.h
⨯

ᠭ           getbkcolor 頥 ⥪騩 梥  䮭.  (c
                   ஡  ⠡  setbkcolor.)

頥       getbkcolor 頥 ⥪騩 梥 䮭.
祭

७ᨬ      㭪 㭨쭠  Borland  C++.    ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨ ०.   㭪      ᮢ⨬   
                   Windows.

 ⠪     getcolor, getmaxcolor, getpalette, setbcolor.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
int bkcolor,midx,midy;
char bkname[35];

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
midx = getmaxx() / 2;
midy = getmaxy() / 2;
setcolor(getmaxcolor(1));
/* ⠭ 業஢ ⥪ */
settextjustify(CENTER_TEXT,CENTER_TEXT);
/*  ⥪騩 梥 䮭 */
bkcolor = getbkcolor();
/* ८ࠧ   ப */
itoa(bkcolor,bkname,10);
strcat(bkname," -  ⥪騩 梥 䮭");
/* 뢥 ᮮ饭 */
outtext(midx,midy,bkname);
/* ⪠ */
getch();
closegraph();
return 0;
}


getc

㭪              ⮪ ᨬ.

⠪          #include <stdio.h>
                   int getc(FILE *stream);

, ᮤঠ騩   stdio.h
⨯

ᠭ           㭪 getc  ।⠢   ᮡ   ப,
                     砥  ᫥騩   浪 ᨬ 
                   室 ⮪  stream    㢥稢  㪠⥫
                   ⥪饣   ⮪  1.

頥        ᯥ譮  襭  㭪  getc 頥
祭           ⠭    ᨬ     ᫥     ।⥫쭮
                   ८ࠧ     楫  ७ .
                     樨 EOF   訡  
                   頥 EOF.

७ᨬ      㭪 ন  ⥬ UNIX, ᠭ
                   ୨  . ন ⠭⮬ ANSI
                   C.

 ⠪     fdetc, getch, getchar, getche, gets, putc, putchar,
                   ungetc.

ਬ:

#include<stdio.h>

int main(void)
{
   char ch;
   printf(" ᨬ :");
   /*  ᨬ  ⠭⭮ 室 ⮪ stdin */
   ch = getc(stdin);
   printf("  ᨬ '%c'\n",ch);
   return 0;
}


getcbrk

㭪            砥 ࠬ ஫  뢠 
                   Ctrl_Break.

⠪          #include<dos.h>
                   int getcbrk(void);

, ᮤঠ騩   dos.h
⨯

ᠭ           㭪 getcbrk ᯮ ⥬ 맮  MS-DOS
                   0x33  祭 ⥪ ࠬ஢ ஫ 
                   뢠 Ctrl_Break.

頥       㭪 getcbrk 頥 0 ᫨ ஫ 
祭           뢠ﬨ 몫祭  (off),   1,  ᫨ ஫
                   祭 (on).

७ᨬ      㭪 㭨쭠  DOS.

 ⠪     ctrlbrk, setcbrk.

ਬ:

#include<stdio.h>
#include<dos.h>

int main(void)
{
   if(getcbrk())
     printf(" Ctrl-Break 祭\n");
   else
     printf(" Ctrl-Break 몫祭\n");
   return 0;
}


getch

㭪             ᨬ  ᮫  宯.

⠪          #include<conio.h>
                   int getch(void);

, ᮤঠ騩   conio.h
⨯

ᠭ           㭪 getch ⠥  ᨬ,  ।⢥
                    ᮫,  뢮   ࠭.

頥       getch 頥    ᨬ.
祭

७ᨬ      㭪 㭨쭠  DOS. 㭪  ᮢ⨬ 
                   Windows.

 ⠪     cgets, cscanf, fdetc, getc, getchar, getche, getpass,
                   kbhit, putch, ungetc.

ਬ:

#include<conio.h>
#include<stdio.h>

int main(void)
{
   int c;
   int extended = 0;
   c = getch();
   if(!c)
     extended = getch();
   if(extended)
     printf("७ ᨬ\n");
   else
     printf(" ७ ᨬ\n");
   return 0;
}


getchar

㭪             ᨬ  ⮪ stdin.

⠪          #include <stdio.h>
                   int getchar(void);

, ᮤঠ騩   stdio.h
⨯

ᠭ           getchar -    ப,    ᨬ 
                   ⮪ stdin.   ।  ᫥騬  ࠧ:
                   getc(stdin).

頥        ᯥ譮 襭 㭪 getchar 頥
祭           ⠭ ᨬ      ᫥       ।⥫쭮
                   ८ࠧ     楫  ७ .
                     樨 EOF   訡  
                   頥 EOF.

७ᨬ      㭪 ন  ⥬ UNIX, ᠭ
                   ୨  . ন ⠭⮬ ANSI
                   C. 㭪  ᮢ⨬  Windows.

 ⠪     fdetc, fgetchar, getch, getche, gets, putc,
                   putchar, scanf, ungetc.

ਬ:

#include<stdio.h>

int main(void)
{
   char c;
   /* 砭. getchar ⠥ ᨬ  stdin,  
         ப. ⮬  祣  頥 
       ,     Enter */
   while((c=getchar())!='\n')
     printf("%c",c);
   return 0;
}


getche

㭪             ᨬ    ᮫    ⮡ࠦ     
                   ࠭.

⠪          #include<conio.h>
                   int getche(void);

, ᮤঠ騩   conio.h
⨯

ᠭ           㭪 getche  뢠   ᨬ  ᮫ 
                   ६ ⮡ࠦ     ⥪饬  ⥪⮢
                       ࠭,  ᯮ  -
                    BIOS.

頥       getche 頥 ᨬ,   .
祭

७ᨬ      getche 㭨쭠  DOS.  㭪  ᮢ⨬ 
                   Windows.

 ⠪     cgets, cscanf, fdetc, getc, getch, getchar, kbhit,
                   putch, ungetc.

ਬ:

#include<conio.h>

int main(void)
{
   char ch;
   printf(" ᨬ:");
   ch = getche();
   printf("\n   ᨬ '%c'\n",ch);
   return 0;
}


getcolor

㭪            頥 ⥪騩 梥 㭪.

⠪          #include <graphics.h>
                   int far getcolor(void);

, ᮤঠ騩   graphics.h
⨯

ᠭ           getcolor 頥  ⥪騩  梥  뢮.   
                   뢮 -    祭   ஥ ⠭
                   ᥫ,      ..  ਬ, 
                   ०  CGACO,    ᮤন  4 梥 :  梥
                   䮭,  ᢥ⫮ ,  ᢥ⫮   . 
                   ⮬ ०,  ᫨ getcolor 頥 1,  ⥪騩
                   梥 뢮 - ᢥ⫮-.
                   
頥       getcolor 頥 ⥪騩 梥 뢮.
祭

७ᨬ      㭪 㭨쭠  Borland  C++.    ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨  ०.  㭪      ᮢ⨬   
                   Windows.

 ⠪     getbkcolor, getmaxcolor, getpalette, setcolor.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
int color,midx,midy;
char colname[35];

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
midx = getmaxx() / 2;
midy = getmaxy() / 2;
setcolor(getmaxcolor(1));
/* ⠭ 業஢ ⥪ */
settextjustify(CENTER_TEXT,CENTER_TEXT);
/*  ⥪騩 梥 䮭 */
color = getcolor();
/* ८ࠧ   ப */
itoa(color,colname,10);
strcat(colname," -  ⥪騩 梥 ᮢ");
/* 뢥 ᮮ饭 */
outtext(midx,midy,colname);
/* ⪠ */
getch();
closegraph();
return 0;
}


getcurdir

㭪            砥 ⥪騩    ⠫          㪠
                   ன⢠.

⠪          #include<dir.h>
                   int getcurdir(int drive, char * direc);

, ᮤঠ騩   dir.h
⨯

ᠭ           㭪 getcurdir  砥  ⥪饣 ⠫
                    㪠 ன⢠ drive.

                   ࠬ drive  ᮤন    ன⢠ (0= 
                   㬮砭, 1=A,  ..)

                   ࠬ direc 㪠뢠     
                   MAXDIR,   ࠭  ⠫.  ⠫ -
                    ᨬ쭠 ப  㫥  砭  -  
                   ᮤন  ᯥ䨪樨  ன⢠   稭
                      (\).

頥       㭪 getcurdir 頥 0  ᯥ譮 -
祭           襭  -1   訡.

७ᨬ      㭪 㭨쭠  DOS.

 ⠪     chdir, getcwd, getdisk, mkdir, rmdir.


getcwd

㭪            砥  ⥪饣 ࠡ祣 ⠫.

⠪          #include<dir.h>
                   char * getcwd(char * buf, int buflen);

, ᮤঠ騩   dir.h
⨯

ᠭ           㭪 getcwd  砥      
                   ⥪饣 ࠡ祣    ⠫    (cwd),    
                   ᯥ䨪 ன⢠,   buflen    
                          ६  buf.  ᫨  
                      ( 㫥 砭)
                    buflen, ࠡ뢠 訡.

                   ᫨ ࠬ   buf    祭  NULL,  
                     n  ⮢  㤥  뤥      
                   malloc.  ⥬      ᢮  뤥
                   ,  ।  祭,   祭   㭪樥
                   getcwd - 㭪樨 free.

頥       㭪 getcwd 頥 ࠬ buf,  砥
祭           訡 頥 祭 NULL.
                                                          
                   ᫨ ࠬ  buf      ࠢ   NULL,   㭪
                   頥 㪠⥫  뤥 .
                   
                   ஬ ⮣,  ᫨  ந諠  訡,   쭠
                   ६   errno   砥      ᫥
                   祭:

                   ENODEV -  ⠪ ன⢠.
                   ENOMEM -  墠⠥ .
                   ERANGE -  ॢ蠥 ⨬ ண.

७ᨬ      㭪 㭨쭠  DOS.

 ⠪     chdir, getcurdir, getdisk, mkdir, rmdir.

ਬ:

#include<stdio.h>
#include<dir.h>

int main(void)
{
   char buffer[MAXPATH];
   getcwd(buffer,MAXPATH);
   printf(" ४: %s\n",buffer);
   return 0;
}


getdate

㭪            砥 ⥬ .

⠪          #include <dos.h>
                   void getdate(struct date * datep);

, ᮤঠ騩   dos.h
⨯

ᠭ           㭪 getdate        date   (
                   㪠⥫  datep) ⥬ ଠ樥  ⥪饩
                   .

                    date । ᫥騬 ࠧ:

                   struct date {
                      int da_year;   /* ⥪騩  */
                      char da_day;   /*   */
                      char da_mon;   /*  (1= ﭢ.) */
                   };

頥       .
祭

७ᨬ      㭪 㭨쭠  DOS.

 ⠪     ctime, gettime, setdate, settime.

ਬ:

#include<dos.h>
#include<stdio.h>

int main(void)
{
   struct date d;
   getdate(&d);
   printf(" :%d\n",d.da_year);
   printf(":%d\n",d.da_mon);
   printf(":%d\n",d.da_day);
   return 0;
}


getdefaultplatte

㭪            頥  । .

⠪          #include <graphics.h>
                   struct palettetype *far getdefaultpalette(void);

, ᮤঠ騩   graphics.h
⨯

ᠭ           getdefaultpalette 室    palettetype,
                       ᮤন     ,     ࢮ砫쭮
                   ⠭   ࠩ஬      ६  믮
                   initgraph.

頥       getdefaultpalette 頥 㪠⥫ 
祭           , ⠭       㬮砭   ⥪騬
                   ࠩ஬  ६ 樠樨 ⮣ ࠩ.

७ᨬ      㭪 㭨쭠  Borland  C++.    ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨  ०.  㭪      ᮢ⨬   
                   Windows.

 ⠪     getpalette, initgraph.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
/* 㪠⥫   ᠭ  */
struct palettetype far *ptr = NULL;
int i;

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
/*  㪠⥫   */
ptr = getdefaultpalette();
for(i=0;i<pal->size;i++);
{
   printf("梥[%d] = %d\n",i,ptr->colors[i]);
   getch();
}
/* ⪠ */
getch();
closegraph();
return 0;
}


getdfree

㭪            砥 ଠ  稨 ᢮  
                   ᪥.

⠪          #include <dos.h>
                   void getdfree(unsigned char drive,
                                   struct dfree *dtable);

, ᮤঠ騩   dos.h
⨯

ᠭ           㭪 getdfree     ᬠਢ     ன⢮,
                    ࠬ஬ drive (0=  㬮砭, 1=A,
                     .  .)     dfree  
                   㪠⥫         dtable         ࠪ⨪
                   ᮮ⢥饣 ᪠.

                    dfree 뢠 ᫥騬 ࠧ:

                   struct dfree {
                      unsigned df_avail; /* ᢮  */
                      unsigned df_total; /* 饥 ⢮ -
                                            ஢ */
                      unsigned df_bsec;  /* ⮢  ᥪ */
                      unsigned df_sclus; /* ᥪ஢   */
                   };

頥       㭪 getdfree  頥  祭.
祭            砥 訡 ࠬ df_sclus  
                   dfree ᢠ 祭 0xFFFF.

७ᨬ      㭪 㭨쭠  DOS.

 ⠪     getfat, getfatd.

ਬ:

#include<stdio.h>
#include<stdlib.h>
#include<dir.h>
#include<dos.h>

int main(void)
{
   struct dfree free;
   long avail;
   int drive;
   drive = getdisk();
   getdfree(dreve+1,&free);
   if(free.df_clus == 0xFFFF)
   {
      printf("訡 getdfree\n");
      exit(1);
   }
   avail = (long) free.df_avail * (long) free.df_bsec *
           (long) free.df_sclus;
   printf(" ᪥ %c  %ld ᢮ \n",'A'+drive,avail);
   return 0;
}


getdisk

㭪            砥  ⥪饣 ன⢠.

⠪          #include<dir.h>
                   int getdisk(void);

, ᮤঠ騩   dir.h
⨯

ᠭ           㭪 getdisk 砥  ⥪饣 ன⢠
                    頥 楫 ᫮ :  0=A:;  1=B:;  2=C:;  
                   .. (⭠ ⥬ 맮 DOS 0x19).

頥       㭪 getdisk 頥  ⥪饣
祭           ன⢠.

७ᨬ      㭪 㭨쭠  DOS.

 ⠪     getcurdir, setdisk, getcwd.

ਬ:

#include<stdio.h>
#include<dir.h>

int main(void)
{
   int disk;
   disk = getdisk()+'A';
   printf("騩 ᪮: %c\n",disk);
   return 0;
}


getdrivername

㭪            頥 㪠⥫    ப,  ᮤঠ  
                   ⥪饣 ᪮ ࠩ.

⠪          #include <graphics.h>
                   char *far getdrivername(void)

, ᮤঠ騩   graphics.h
⨯

ᠭ           ᫥ 맮  initgraph,  getdrivername 頥
                    ࠩ,  㦥   .

頥       getdrivername 頥 㪠⥫  ப,
祭            ᮤন  ⥪饣 ࠩ.

७ᨬ      㭪 㭨쭠    Borland C++.   ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨   ०.   㭪     ᮢ⨬  
                   Windows.

 ⠪     initgraph.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
/* 㪠⥫   ࠩ */
char *drivername;

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
setcolor(getmaxcolor());
/*   ⥪饣 ᯮ㥬 ࠩ */
drivername = getdrivername();
/* ⠭ ࠢ ⥪ */
settextjustify(CENTER_TEXT,CENTER_TEXT);
/* 뢥  ࠩ */
outtextxy(getmaxx()/2,getmaxy()/2,drivername);
/* ⪠ */
getch();
closegraph();
return 0;
}


getdta

㭪            砥  DTA ( 裡  ᪮).

⠪          #include<dos.h>
                   char far * getdta(void);

, ᮤঠ騩   dos.h
⨯

ᠭ           㭪 getdta  頥 ⥪饥 祭 
                   DTA.            ।       
                   ।,    ᥣ⮬    ⥪騩
                   ᥣ .  ᫨  ᯮ ᪫⥫쭮
                    C,     ࠭,  ᫨   
                   㤥  ᯮ짮  ணࠬ   ᥬ,
                    DTA     .

                    ,       ᢥ塮   
                      ,   頥   㭪樥  getdta,
                     ॠ쭮    ᮬ       
                   ᯮ  । ணࠬ.

頥       㭪 getdta 頥 "쭨" 㪠⥫ 
祭           ⥪ DTA.

७ᨬ      㭪 㭨쭠  DOS.

 ⠪     fcb (), setdta.

ਬ:

#include<dos.h>
#include<stdio.h>

int main(void)
{
   char far *dta;
   dta = getdta();
   printf("  裡  ᪮: %Fp\n",dta);
   return 0;
}


getenv

㭪            砥 ᨬ ப, ᮤঠ ࠬ
                   樮 ।.

⠪          #include<stdlib.h>
                   char *getenv(const char *name);

, ᮤঠ騩   stdlib.h
⨯

ᠭ           㭪 getenv   頥   祭   㪠
                   ६   樮  ।.    ६
                      ᨬ    孥  ⠪  
                     ॣ,       ᨬ
                   ࠢ   (=).   ᫨   㪠   ६    
                   ।,  㭪 頥  ப.

頥        ᯥ譮 襭 㭪 getenv 頥
祭           㪠⥫  祭, ᮮ⢥饥 name.
                   ᫨   ६  name      ।,
                   㭪 getenv 頥  ப.

                   ਬ砭.    㦥    
                   ।⢥.  ᫨    祭
                   ६  㦥,  室 ᯮ짮
                   㭪樥 putenv.

७ᨬ      㭪樨 ন  ⥬ UNIX  ⠭-
                   ⮬ ANSI C.

 ⠪     environ(variable), getpsp, putenv.

ਬ:

#include<stdlib.h>
#include<stdio.h>

int main(void)
{
   char *s;
   s = getenv("COMSPEC"); /*  ࠬ । */
   printf("  室: %s\n",s);
   return 0;
}


getfat

㭪            砥 ଠ  ⠡ ࠧ饭 䠩
                   㪠 ᪮.

⠪          #include <dos.h>
                   void getfat(unsigned char drive,
                                          struct fatinfo *dtable);

, ᮤঠ騩   dos.h
⨯

ᠭ           㭪 getfat 頥  ଠ    ⠡
                   ࠧ饭     䠩     ᮣ᭮    ᯥ䨪樨
                   ன⢠,     ࠬ  drive(0  =  
                   㬮砭,  1=A:;  2=B:;  ..). ⥫ dtable
                     ᮬ      fatinfo,   
                    ଠ樥  ⠡.

                    fatinfo,  塞  㭪樥   getfat
                   뢠 ᫥騬 ࠧ:

                   struct fatinfo {
                      char fi_sclus;  /* ᥪ஢   */
                      char fi_fatid;  /*  䨪樨 ⠡
                                      FAT (⠡ ࠧ饭 䠩)
                      int fi_nclus;   /* ⢮ ஢ */
                      int fi_busec;   /* ⢮ ⮢  ᥪ-
                                          */
                   };

頥       .
祭

७ᨬ      㭪 㭨쭠  DOS.

 ⠪     getdfree, getfatd.

ਬ:

#include<stdio.h>
#include<conio.h>
#include<dos.h>

int main(void)
{
   struct fatinfo diskinfo;
   int flag = 0;
   printf("⠢ ᪥  ᪮ 'A'\n");
   getch();
   getfat(1,&diskinfo); /* 祭 -樨  ᪮ */
   printf("᪮ A:");
   switch((unsigned char)diskinfo.fatid)
   {
   case 0xFD: printf("360 , ୮ ⭮\n");
              break;
   case 0xF9: printf("5 1/4'' - 1.2 M  3 1/2''- 720 ");
              break;
   case 0xF0: printf("3 1/2 - 1.44\n");
              break;
   default:   printf("ଠ஢\n");
              flag = 1;
   }
   if(!flag)
   {
      printf("஢  : %5d\n",diskinfo.fi_sclus);
      printf("⢮ ஢: %5d\n",diskinfo.fi_nclus);
      printf("  ᥪ: %5d\n",diskinfo.fi_bysec);
   }
   return 0;
}


getfatd

㭪            砥 ଠ  ⠡ ࠧ饭 䠩.

⠪          #include <dos.h>
                   void getfatd(struct fatinfo *dtable);

, ᮤঠ騩   dos.h
⨯

ᠭ           㭪 getfatd  頥  ଠ  ⠡
                   ࠧ饭  䠩  ᪮,  ᯮ㥬   
                   㬮砭.   ⥫   dtable    ᮬ
                    fatinfo,   ଠ樥
                    ⠡.

                    fatinfo,  塞  㭪樥  getfat,
                   뢠 ᫥騬 ࠧ:

                   struct fatinfo {
                      char fi_sclus;  /* ᥪ஢   */
                      char fi_fatid;  /*  䨪樨 ⠡
                                      FAT (⠡ ࠧ饭 䠩)
                      int fi_nclus;   /* ⢮ ஢ */
                      int fi_busec;   /* ⢮ ⮢  ᥪ-
                                          */
                   };

頥       .
祭

७ᨬ      㭪 㭨쭠  DOS.

 ⠪     getdfree, getfat.

ਬ:

#include<stdio.h>
#include<dos.h>

int main(void)
{
   struct fatinfo diskoinfo;
   getfatd(&diskinfo); /*  ଠ  ᪮ */
   printf("᪮  㬮砭:");
   printf("஢  : %5d\n",diskinfo.fi_sclus);
   printf(" FAT ID: %5X\n",diskinfo.fi_fatid & 0xFF);
   printf("⢮ ஢: %5d\n",diskinfo.fi_nclus);
   printf("  ᥪ: %5d\n",diskinfo.fi_bysec);
   return 0;
}


getfillpattern

㭪                । 짮⥫
                   蠡 .

⠪          #include <graphics.h>
                   void far getfillpattern(char far *pattern);

, ᮤঠ騩   graphics.h
⨯

ᠭ           getfillpattern       蠡     ,
                   ।  짮⥫     ⠭   
                     setfillpattern,    8- ,  
                    㪠뢠 pattern.
                   
                   pattern -  㪠⥫  ᫥⥫쭮  8
                   ,      ᮮ⢥  8  ᥫ
                   蠡.  直 ࠧ,    ⠭ 
                   1, ᮮ⢥騩 ᥫ ⮡ࠦ  ࠭.
                   ਬ,   ᫥騩  ।  짮⥫
                   ࠧ ਢ  筮 㭪:

                   char checkboard[8] = {
                          0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55,
                          0xAA, 0x55
                         };

頥       .
祭

७ᨬ      㭪 㭨쭠    Borland C++.   ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨  ०.  㭪      ᮢ⨬   
                   Windows.

 ⠪     getfillsettings, setfillpattern.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
int maxx,maxy;
char pattern[8] = {0x00,0x70,0x20,0x27,0x25,0x27,0x04,0x04);

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
maxx = getmaxx();
maxy = getmaxy();
setcolor(getmaxcolor());
/*  짮⥫᪨ 蠡 */
setfillpattern(pattern,getmaxcolor());
/*  ࠭   ⮣ 蠡 */
bar (0,0,maxx,maxy);
getch();
/*  ⥪騩 蠡 */
getfillpattern(pattern);
/*   */
pattern[4] -= 1;
pattern[5] -= 2;
pattern[6] -= 3;
pattern[7] -= 4;
/* ⠭  蠡 */
setfillpattern(pattern,getmaxcolor());
/*   ࠭ */
bar(0,0,maxx,maxy);
/* ⪠ */
getch();
closegraph();
return 0;
}


getfillsettings

㭪            砥 ଠ  ⥪饬 蠡  梥
                   .

⠪          #include <graphics.h>
                   void far getfillsettings(struct
                             fillsettingstype far *fillinfo);

, ᮤঠ騩   graphics.h
⨯

ᠭ
                   getfillsettings                 
                   fillsettingstype,     㪠뢠  fillinfo
                   ଠ樥   ⥪饬 蠡  梥 .
                   fillsettingstype   ।        graphics.h
                   ᫥騬 ࠧ:

                   struct fillsettingstype{
                    int pattern; /* ⥪騩 蠡  */
                    int color;   /* ⥪騩 梥  */
                   };

                   㭪樨 bar, bar3d, fillpoly, floodfill  pieslice
                   楫         ⥪騬   蠡
                     ⥪饬 梥 .  
                   11        蠡       (ᯫ譮,
                   ⮮ࠧ,  筮  .  .)  ᪨
                         ஥  蠡  ᯥ稢
                   塞 ⨯  fill_patterns    graphics.h.
                   (ᬮ ⠡,  ਢ ).  ஬ ⮣,
                     । ᢮ ᮡ⢥ 蠡.

                   ᫨ pattern ࠢ 12  (USER_FILL),      
                   ६     ᯮ     蠡,    ।塞
                   짮⥫;   ⨢ 砥 pattern  
                      ஥   蠡.
                   
                   塞 ⨯    fill_patterns,      
                   graphics.h         ஥    蠡
                       蠡,  ।塞
                   짮⥫.


             祭            ᠭ

  EMPTY_FILL          0         梥⮬ 䮭
  SOLID_FILL          1        ᯫ譮  梥⮬
                               
  LINE_FILL           2         ______
  LSTLASH_FILL        3         //////
  SLASH_FILL          4         /// ⮫⮩ 
  BKSLASH_FILL        5         \\\ ⮫⮩ 
  LTBKSLASH_FILL      6         \\\\
  HATCH_FILL          7        ᢥ⫠ 客 ⪮
  XHATCH_FILL         8        ⮮ࠧ 客
  INTERLEAVE_FILL     9        ⪠ࠧ 客
  WIDE_DOT_FILL       10        । 窠
  CLOSE_DOT_FILL      11        묨 窠
  USER_FILL           12       蠡 , ।塞
                               짮⥫


                   , ஬  EMPTY_FILL    ⥪騬  梥⮬
                   ;  EMPTY_FILL  ᯮ  ⥪騩  梥
                   䮭.

頥       .
祭

७ᨬ      㭪 㭨쭠  Borland  C++.    ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨   ०.   㭪     ᮢ⨬  
                   Windows.

 ⠪     getfillpattern, setfillpattern, setfillstyle.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

/*  ন ⨯  */
char *fname[] = {"EMPTY_FILL",
                 "SOLID_FILL",
                 "LINE_FILL",
                 "LSTLASH_FILL",
                 "SLASH_FILL",
                 "BKSLASH_FILL",
                 "LTBKSLASH_FILL",
                 "HATCH_FILL",
                 "XHATCH_FILL",
                 "INTERLEAVE_FILL",
                 "WIDE_DOT_FILL",
                 "CLOSE_DOT_FILL",
                 "USER_FILL"
                };

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
struct fillsettingstype fillinfo;
int maxx,maxy;
char patstr[40],colstr[40];

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
maxx = getmaxx()/2;
maxy = getmaxy()/2;
/*  ଠ  ⥪饬 蠡  梥 */
getfillsettings(*fillinfo);
/* ८ࠧ  ப */
sprintf(patstr,"  :%s.",fname[fillinfo.pattern]);
sprintf(colstr," :%d",fillinfo.color);
/* 뢥 ଠ */
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(midx,midy,patstr);
outtextxy(midx,midy+2*textheight("W"),colstr);
/* ⪠ */
getch();
closegraph();
return 0;
}


getftime

㭪            砥   ६ ᮧ  ᫥
                   䨪樨 䠩.

⠪          #include <io.h>
                   int getftime(int handle, struct ftime * ftimep);

, ᮤঠ騩   io.h
⨯

ᠭ           㭪 getftime 頥 ६    ᮧ
                      䠩,  ᮮ⢥饣  ࠬ  handle,
                   祭  ⨨ 䠩.   ftime 
                     㪠⥫  ftimep  묨 
                   ६ ᮧ 䠩.

                    ftime 뢠 ᫥騬 ࠧ:

                   struct ftime {
                      unsigned ft_tsec:5;  /*  ᥪ㭤 */
                      unsigned ft_min:6;   /*  */
                      unsigned ft_hour:5;  /*  */
                      unsigned ft_day:5;   /*  */
                      unsigned ft_month:4; /*  */
                      unsigned ft_year:7;  /* -1980 */
                   }

頥        ᯥ譮   襭   頥   0.   ᫨
祭           ந諠  訡,  頥  祭  -1   
                   쭮 ६ errno ᢠ 祭
                     ᫥ ⠭:

                   EINVFNC -   㭪樨.
                   EBADF   -   䠩.

७ᨬ      㭪 㭨쭠  DOS.

 ⠪     open, setftime.

ਬ:

#include<stdio.h>
#include<io.h>

int main()
{
   FILE *stream;
   struct ftime ft;
   if((stream = fopen("TEST.$$$","wt"))== NULL)
   {
      fprintf(stderr,"   䠩\n");
      return 1;
   }
   getftime(fileno(stream),&ft);
   printf("६ 䨪樨 䠩:%02u:%02u,%02u\n",
            ft.ft_hour,ft.ft_min,ft.ft_tsec/2);
   printf(": %02u%02u%04u\n",ft.ft_month,ft.ft_day,
            ft.ft_year+1980);
   return 0;
}


getgraphmode

㭪            頥 ⥪騩 ᪨ ०.

⠪          #include <graphics.h>
                   int far getgraphmode(void)

, ᮤঠ騩   graphics.h
⨯

ᠭ            ணࠬ    ᯥ譮  믮   맮
                   initgraph    맮 getgraphmode.  塞
                   ⨯  graphics_mode,  ।      graphics.h
                      ஥ ᪨ ०.  
                     ⠡楩,⮡ࠦ饩  祭,
                   ᫥   ᠭ initgraph.

頥       getgraphmode 頥 ᪨ ०,
祭           ⠭ integraph  setgraphmode.

७ᨬ      㭪 㭨쭠  Borland  C++.    ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨   ०.   㭪     ᮢ⨬  
                   Windows.

 ⠪     getmoderange, restorecrtmode, setgraphmode.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
int midx,midy,mode;
char numname[80],modename[80];

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
midx = getmaxx()/2;
midy = getmaxy()/2;
/*   ० */
mode = getgraphmode();
sprintf(numname," ०: %d",mode);
sprintf(modename,"騩 ᪨ ०: %s\n",getmodename(mode));
/* 뢥 ଠ */
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(midx,midy,numname);
outtextxy(midx,midy+2*textheight("W"),modename);
/* ⪠ */
getch();
closegraph();
return 0;
}


getimage

㭪             ⮢ ࠧ ன  ࠭.

⠪          #include <graphics.h>
                   void far getimage(int left, int top, int
                                      right,int bottom, void
                                      far *bitmap);

, ᮤঠ騩   graphics.h
⨯

ᠭ           getimage   ࠧ c ࠭  .  left,
                   top,  right   bottom  ।    ࠭
                   אַ㣮쭮  ,    㤥 ᪮஢.
                   bitmap  㪠뢠         ,   㤠
                   뢠 ⮢ ࠧ.    ᫮ ⮩
                      ਭ      אַ㣮쭨,
                   ⠢訥 । ᠬ ࠧ.

頥       .
祭

७ᨬ      㭪 㭨쭠  Borland  C++.    ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨   ०.   㭪     ᮢ⨬  
                   Windows.

 ⠪     imagesize, putimage, putpixel.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<alloc.h>

void save_screen(void far *buf[4]);
void restore_screen(void far *buf[4]);
int maxx,maxy;

int main(void)
{
int graphdriver = DETECT, gmode, errorcode;
void far *ptr[4];

/* ⮬᪮ । ࠩ  ० */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
maxx = getmaxx();
maxy = getmaxy();
/* ᮢ  ࠭ ࠦ */
rectangle(0,0,maxx,maxy);
line(0,0,maxx,maxy);
line(0,maxx,maxy,0)
save_screen(ptr);        /* ࠭ ࠭ */
getch();                 /* 㧠 */
cleardevice();           /* 㫥 ࠭ */
restore_screen(ptr);     /* ⠭ ࠭ */
getch();                 /* 㧠 */

closegraph();
return 0;
}

void save_screen(void far *buf[4])
{
   unsigned size;
   int ystart=0,yend,yincr,block;
   yincr = (maxy+1)/4;
   yend = yincr;
   size = imagesize(0,ystart,maxx,yend); /*  ࠧ -
                                            ࠦ  */
   for(block = 0; block<=3; block++)
   {
      if(buf[block] = farmalloc(size))== NULL)
      {
         closegraph();
         printf("訡!  墠⠥   ࠭ ࠭\n");
         exit(1);
      }
   getimage(0,ystart,maxx,yend,buf[block]);
   ystart = yend+1;
   yend += yincr+1;
   }
}
void restore_screen(void far *buf[4]);
{
   int ystart=0,yend,yincr,block;
   yincr = (maxx+1)/4;
   yend = yincr;
   for(block=0;block<=3;block++)
   {
      putimage(0,ystart,buf[block],COPY_PUT);
      farfree(buf[block]);
      ystart = yend+1;
      yend += yincr+1;
   }
}


getlinesttings

㭪            砥 ⥪騩 梥 , 蠡  ⮫騭.

⠪          #include <graphics.h>
                   void far getlinesettings(struct linesettingstype
                                                 far *lineinfo);

, ᮤঠ騩   graphics.h
⨯

ᠭ           getlinesettings    linesettings,
                           㪠뢠    ࠬ    lineinfo
                   ଠ樥,    ⥪饬  ⨯  ,  ⮫騭  
                   蠡.

                    linesettingstype ।  graphics.h
                   ᫥騬 ࠧ:

                       struct linesettingstype{
                          int linestyle;
                          unsigned upattern;
                          int thickness;
                       };

                   linestyle ।   ⨯  ,    㤥
                   ᯮ짮     (     뢭,     㭪,
                   㭪,    客).   塞   ⨯
                   line_styles,  ।     graphics.h,   
                   ᨬ᪨  ⨬ :

                   
                           .       ᠭ
                   
                    SOLID_LINE        0     ᯫ譠
                    DOTTED_LINE       1     㭪
                    CENTER_LINE       2     㭪
                    DASHED_LINE       3     客
                    USERBIT_LINE      4     ⨯ , 
                                            짮⥫
                    

                   thickness ।,    ᫥騥  
                   ⮭  ⮫묨.

                   
                           .       ᠭ
                   
                    NORM_WIDTH        1     ⮫設  1 ᥫ
                    THICK_WIDTH       3     ⮫騭  3 ᥫ
                   

                   upattern -      16-    蠡,    
                   ᯮ,   ⮫쪮      linestyle   ࠢ
                   USERBIT_LINE (4).    ⮬  砥      
                   蠡,  ⠭  1, ᮮ⢥ ᥫ
                      ⥪饬 梥. ਬ, ᯫ譮 
                   ᮮ⢥  upattern  ࠢ 0xFFFF ( 
                    ᥫ),   㭪 ᮮ⢥  upattern,
                   ࠢ   0x3333     0x0F0F.  ᫨    ࠬ
                   linestyle   setlynestyle    ࠢ  USERBIT_LINE
                   (!=4),         upattern    ন,    
                   .

頥       .
祭

७ᨬ      㭪 㭨쭠  Borland  C++.    ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨  ०.  㭪      ᮢ⨬   
                   Windows.

 ⠪     setlinestyle.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

/*  ন ⨯  */
char lname[] = {"SOLID_LINE",
                "DOTTED_LINE",
                "CENTER_LINE",
                "DASHED_LINE",
                "USERBIT_LINE"
                };

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
struct linrsettingstype lineinfo;
int midx,midy;
char lstyle[80],lpattern[80],lwigth[80];

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
midx = getmaxx()/2;
midy = getmaxy()/2;
/*  ଠ  ⨯  */
getlinesettings(&lineinfo);
/* ८ࠧ  ப */
sprintf(lstyle," : %s\n",lname[lineinfo.linestyle]);
sprintf(lpattern," ।塞 짮⥫: 0x%F",
        lineinfo.upattern);
sprintf(lwigth,"騭 : %d\n",lineinfo.thickness);

/* 뢥 ଠ */
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(midx,midy,lstyle);
outtextxy(midx,midy+2*textheight("W"),lpattern);
outtextxy(midx,midy+4*textheight("W"),lwigth);
/* ⪠ */
getch();
closegraph();
return 0;
}


getmaxcolor

㭪            頥 ᨬ쭮  祭  梥,  ஥
                     । 㭪樨 setcolor.

⠪          #include <graphics.h>
                   int far getmaxcolor(void);

, ᮤঠ騩   graphics.h
⨯

ᠭ           getmaxcolor 頥  襥   ⢨⥫쭮
                   祭  梥  ⥪饣 ᪮ ࠩ
                    ०,    । setcolor.

                   ਬ, c  256K  EGA,  getmaxcolor  㤥 ᥣ
                    15.    ,    ⨬  
                   맮  setcolor   祭  0  15.   CGA 
                   ०  ᮪  ࠧ襭       ஬
                     Hercules getmaxcolor 頥 祭
                   1, ..   ন ⮫쪮  梥
                   ᮢ: 0  1.

頥       getmaxcolor 頥 襥 ⨬
祭           祭 梥.

७ᨬ      㭪 㭨쭠    Borland C++.   ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨   ०.   㭪     ᮢ⨬  
                   Windows.

 ⠪     getbcolor, getcolor, getpalette, getpalettesize,
                   setcolor.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
int midx,midy;
char colstr[80];

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
midx = getmaxx()/2;
midy = getmaxy()/2;

/*  ଠ  梥  ८ࠧ  ப */
sprintf(colstr,"  ন 0..%d 梥⮢",
         getmaxcolor());
/* 뢥 ଠ */
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(midx,midy,colstr);
/* ⪠ */
getch();
closegraph();
return 0;
}


getmaxmode

㭪            頥 ᨬ  ०  ⥪饣
                   ࠩ.

⠪          #include <graphics.h>
                   int far getmaxmode(void);

, ᮤঠ騩   graphics.h
⨯

ᠭ
                   getmaxmode     ᨬ 
                   ०      ⥪饣   㦥   ࠩ,
                   ।⢥    ⮣ ࠩ.    
                   २⢮   getmoderange,    ࠡ⠥
                   ⮫쪮   ࠩࠬ Borland.   ० -
                   0.

頥       getmaxmode 頥 ᨬ 
祭           ०  ⥪饣 ࠩ.

७ᨬ      㭪 㭨쭠  Borland  C++.    ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨  ०.  㭪      ᮢ⨬   
                   Windows.

 ⠪     getmodename, getmoderange.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
int midx,midy;
char modestr[80];

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
midx = getmaxx()/2;
midy = getmaxy()/2;

/*  ଠ  ०  ८ࠧ  ப */
sprintf(modestr,"  ন ० 0..%d",
         getmaxmode());
/* 뢥 ଠ */
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(midx,midy,modestr);
/* ⪠ */
getch();
closegraph();
return 0;
}


getmaxx

㭪            頥 ᨬ न  ࠭.

⠪          #include <graphics.h>
                   int far getmaxx(void);

, ᮤঠ騩   graphics.h
⨯

ᠭ           getmaxx 頥   ᨬ쭮    (⭮⥫쭮
                   ࠭) 祭   ⥪饣 ࠩ  ०.

                   ਬ,   CGA      ०   320200,   getmaxx
                   頥     319.    getmaxx    業    
                   業஢, । ࠭  o ࠭
                    . .

頥       getmaxx 頥 ᨬ न
祭            ࠭.

७ᨬ      㭪 㭨쭠    Borland C++.   ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨   ०.   㭪     ᮢ⨬  
                   Windows.

 ⠪     getmaxy, getx.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
int midx,midy;
char xrange[80],yrange[80];

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
midx = getmaxx()/2;
midy = getmaxy()/2;

/* ८ࠧ  ப ଠ  ᨬ쭮 ࠧ襭 */
sprintf(xrange," 祭 : 0..%d",getmaxx());
sprintf(yrange," 祭 y: 0..%d",getmaxy());
/* 뢥 ଠ */
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(midx,midy,xrange);
outtextxy(midx,midy+textheight("W"),yrange);
/* ⪠ */
getch();
closegraph();
return 0;
}


getmaxy

㭪            頥 ᨬ न y ࠭.

⠪          #include <graphics.h>
                   int far getmaxy(void);

, ᮤঠ騩   graphics.h
⨯

ᠭ           getmaxy 頥   ᨬ쭮    (⭮⥫쭮
                   ࠭)  祭 y  ⥪饣 祭 ࠩ
                    ०.

                   ਬ,    CGA      ०   320200,  getmaxy
                   頥    199.    getmaxy    業     
                   業஢, । ࠭  o ࠭
                    . .

頥       getmaxy 頥 ᨬ न
祭           y ࠭.

७ᨬ      㭪 㭨쭠  Borland  C++.    ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨   ०.   㭪     ᮢ⨬  
                   Windows.

 ⠪     getmaxx, getx, gety.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
int midx,midy;
char xrange[80],yrange[80];

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
midx = getmaxx()/2;
midy = getmaxy()/2;

/* ८ࠧ  ப ଠ  ᨬ쭮 ࠧ襭 */
sprintf(xrange," 祭 : 0..%d",getmaxx());
sprintf(yrange," 祭 y: 0..%d",getmaxy());
/* 뢥 ଠ */
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(midx,midy,xrange);
outtextxy(midx,midy+textheight("W"),yrange);
/* ⪠ */
getch();
closegraph();
return 0;
}


getmodename

㭪            頥 㪠⥫  ப, ᮤঠ 
                   㪠 ᪮ ०.

⠪          #include <graphics.h>
                   char *far getmodename(int mode_number);

, ᮤঠ騩   graphics.h
⨯

ᠭ           getmodename 砥  ᪮ ० 
                   室  ࠬ  頥 ப,  ᮤঠ
                    ⥪饣 ᪮  ०.    ०
                   ஥    ࠩ.  頥 祭
                   ("320x200 CGA   P1",   "640x200   CGA",     ..)
                   ᯮ  ஥     ⮡ࠦ
                   .

頥       getmodename 頥 㪠⥫  ப
祭             ᪮ ०.

७ᨬ      㭪 㭨쭠    Borland C++.   ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨   ०.   㭪     ᮢ⨬  
                   Windows.

 ⠪     getmaxmode, getmoderange.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
int midx,midy,mode;
char numname[80],modename[80];

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
midx = getmaxx()/2;
midy = getmaxy()/2;
/*   ० */
mode = getgraphmode();
sprintf(numname," ०: %d",mode);
sprintf(modename,"騩 ᪨ ०: %s\n",getmodename(mode));
/* 뢥 ଠ */
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(midx,midy,numname);
outtextxy(midx,midy+2*textheight("W"),modename);
/* ⪠ */
getch();
closegraph();
return 0;
}


getmoderange

㭪            砥  ०   c
                   ࠩ.

⠪          #include <graphics.h>
                   void far getmoderange(int graphdriver, int
                   far *lomode, int far *himode);

, ᮤঠ騩   graphics.h
⨯

ᠭ           getmoderange 砥           ⨬
                   ᪨  ०      ᪮
                   ࠩ   graphdriver.   襥    ⨬
                   祭   ०   頥      *lomode,  
                   襥  ⨬  祭    *himode.  ᫨
                   graphdriver  । 騩 ᪨
                   ࠩ,  *lomonade  *himonade ⠭  
                   -1.  ᫨  祭  grapgdriver  ࠢ -1,  
                   饭 ० ⥪饣 㦥 ࠩ.

頥       .
祭

७ᨬ      㭪 㭨쭠    Borland C++.   ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨   ०.   㭪     ᮢ⨬  
                   Windows.

 ⠪     getgraphmode, getmaxmode, getmodename, initgraph,
                   setgraphmode.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
int midx,midy;
int low,high;
char mrange[80];

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
midx = getmaxx()/2;
midy = getmaxy()/2;
/*  , ⨬   ࠩ ० */
mode = getmoderange(gdriver,&low,&high);
sprintf(mrange,"ࠩ ন ०  : %d..%d",
        low,high);
/* 뢥 ଠ */
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(midx,midy,mrange);
/* ⪠ */
getch();
closegraph();
return 0;
}


getpalette

㭪            砥 ଠ  ⥪饩 .

⠪          #include <graphics.h>
                   void far getpalette(struct palettetype far
                          *palette);

, ᮤঠ騩   graphics.h
⨯

ᠭ               palettetype,       
                   뫠 palette, ଠ樥  ࠧ  
                     梥.  ⠭   MAXCOLORS      
                   palettype,  ᯮ㥬 getpalette,  । 
                   graphics.h ᫥騬 ࠧ:

                   #define MAXCOLORS 15

                   struct palettetype{
                          unsigned char size;
                          signed char colors[MAXCOLORS+1];
                   };

                   size  ⢮  梥⮢      ⥪饣
                   ࠩ  ०.

                   colors -  ᨢ 梥⮢  .

                   ਬ砭. getpalette      ᯮ짮   
                   ࠩ஬  IBM-8514.

頥       .
祭

७ᨬ      㭪 㭨쭠  Borland  C++.    ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨  ०.  㭪      ᮢ⨬   
                   Windows.

 ⠪     getbkcolor, getcolor, getdefaultpalette,
                   getmaxcolor, setallpalette, setpalette.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
struct palettetype pal;
char psize[80],pval[20];
int i,ht;
int y=10';

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
/*    */
getpalette(&pal);
/* ८ࠧ   ப */
sprintf(psize,"  %d 塞 ⮢",pal.size);
/* 뢥 ଠ */
outtextxy(0,y,psize);
if(pal.size != 0)
{
   ht = textheight("W");
   y += 2*ht;
   outtextxy(0,y," ਢ 祭 梥⮢ ");
   y += 2*ht;
   for(i=0; i<pal.size, i++,y+=ht)
   {
      sprintf(pval,"[%02d]:0x%02X",i,pal.colors[i]);
      outtextxy(0,y,pval);
   }
}
/* ⪠ */
getch();
closegraph();
return 0;
}


getpalettesize

㭪            頥 ࠧ ࠢ筮 ⠡ 梥⮢
                   .

⠪          #include <graphics.h>
                   int far getpalettesize(void);

, ᮤঠ騩   graphics.h
⨯

ᠭ           getpalettesize ᯮ   । ⮣,
                     ⮢    ⠭
                    ⥪饣 ᪮ ०.  ਬ, EGA 
                   梥⮢ ० 頥 16.

頥       getpalettesize 頥 ⢮ ⮢
祭            ⥪饩 .

७ᨬ      㭪 㭨쭠    Borland C++.   ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨  ०.  㭪      ᮢ⨬   
                   Windows.

 ⠪     setpalette, setallpalette.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
int midx,midy;
char psize[80];

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
midx = getmaxx()/2;
midy = getmaxy()/2;
/* ८ࠧ  ப ᫮ ⮢  */
sprintf(psize,"  %d 塞 ⮢",
       getpalettesize());
/* 뢥 ଠ */
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(midx,midy,psize);
/* ⪠ */
getch();
closegraph();
return 0;
}


getpass

㭪             ஫.

⠪          #include<conio.h>
                   char *getpass(char *prompt);

, ᮤঠ騩   conio.h
⨯

ᠭ           㭪 getpass  뢠  ஫      ⥬
                   ᮫   ᫥   뤠     ࠭  ᯥ樠쭮
                   ᮮ饭 - ᨬ쭮 ப  㫥 砭
                   (prompt)   ⬥ ⮡ࠦ ஫  ࠭.
                   頥  १ ࠡ 㭪樨 㪠⥫
                     ப  ᨬ    㫥  砭
                        8   ᨬ   (      㫥
                   砭) - ஫.

頥       頥 祭 -  㪠⥫  ப
祭           ᨬ ⨯ static,  १뢠 
                    맮.

७ᨬ      㭪 ন   ⥬ UNIX.  㭪
                    ᮢ⨬  Windows.

 ⠪     getch.

ਬ:

#include<conio.h>

int main(void)
{
   char *password;
   password = getpass(" ஫:");
   cprintf("஫: %s\r\n",password);
   return 0;
}


getpid

㭪            砥 䨪   ணࠬ.

⠪          #include<process.h>
                   unsigned getpid(void);

, ᮤঠ騩   process.h
⨯

ᠭ           䨪     ணࠬ.
                       ࠬ    襫        ⨧
                   樮   ⥬   ⨯   UNIX,    
                    㭨 ஬.

頥       getpid 頥  ᥣ psp ணࠬ.
祭

७ᨬ      ন ⥬ UNIX.

 ⠪     getpsp, _psp(६).

ਬ:

#include<stdio.h>
#include<process.h>

int main(void)
{
   printf("䨪   ணࠬ = %X\n",
           getpid());
   printf(" DOS -   ᥣ PSP\n");
   return 0;
}


getpixel

㭪            頥 梥  窨.

⠪          #include <graphics.h>
                   unsigned far getpixel(int x, int y);

, ᮤঠ騩   graphics.h
⨯

ᠭ           getpixel 砥 梥 窨  न⠬ (x,y).

頥       頥 梥  ᥫ.
祭

७ᨬ      㭪 㭨쭠  Borland  C++.    ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨   ०.   㭪     ᮢ⨬  
                   Windows.

 ⠪     getimage, putpixel.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<dos.h>

#define PIXEL_COUNT 1000
#define DELAY_TIME 100 /*  ᥪ㭤 */

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
int x,y,i,color,maxx,maxy,maxcolor,seed;

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
maxx = getmaxx();
maxy = getmaxy();
maxcolor = getmaxcolor()+1;
while(!kbhit())
{
/*   砩 ᥫ */
seed = random(32767);
stand(seed);
for(i=0;i<PIXEL_COUNT;i++)
{
   x = random(maxx);
   y = random(maxy);
   color = random(maxcolor);
   putpixel(x,y,color);
}
delay(DELAY_TIME);
srand(seed);
for(i=0;i<PIXEL_COUNT;i++)
{
   x = random(maxx);
   y = random(maxy);
   color = random(maxcolor);
   if(color == getpixel(x,y);
     putpixel(x,y,0);
}
}
/* ⪠ */
getch();
closegraph();
return 0;
}


getpsp

㭪            砥   䨪   ணࠬ   ᥣ
                   (psp).

⠪          #include<dos.h>
                   unsigned getpsp(void);

, ᮤঠ騩   dos.h
⨯

ᠭ           㭪 getpsp     砥          䨪
                   ணࠬ ᥣ (PSP) ।⢮ ⥬
                   맮 DOS 0x62.

                    맮 ন ⮫쪮   樮
                   ⥬  DOS ᨩ 3.x.   ᨩ MS-DOS 2.x 
                   3.x  ᯮ짮  ६ _psp,
                   ⠭ ⮢ .

頥       㭪 getpsp 頥  ᥣ PSP.
祭

७ᨬ      㭪 㭨쭠      DOS   ᨨ  3.0    
                   ন   ࠭  DOS.

 ⠪     getenv, _psp(variable).

ਬ:

#include<stdio.h>
#include<dos.h>

int main(void)
{
   static char command[128];
   char far *cp;
   int len,l;
   printf("䨪 ணࠬ ᥣ: %x\n",getpsp());
   /* _psp 砥  䨪 ணࠬ ᥣ.
      ⮪  ப ࠭  psp  ᬥ饭 80H
      ⭮⥫쭮 砫 psp.  ,   -
        㬥. */
   cp = MK_FP(_psp,0x80);
   len = *cp;
   for(i=0; i<len; i++)
      command[i] = cp[i+1];
   printf(" ப:%s\n",command);
   return 0;
}


gets

㭪             ப ᨬ  ⮪.

⠪          #include<stdio.h>
                   char *gets(char *s);

, ᮤঠ騩   stdio.h
⨯

ᠭ           㭪 gets     ⠥      ப      ᨬ,
                   稢    ᨬ   ॢ   ப   
                   ६  *s    ⠭⭮  室  ⮪
                   stdin.      ᨬ쭠  ப  稢
                   ᨬ 室     ப,    
                     *s   㫥 砭 (\0).

                    ⫨稥  scanf, gets   ப,
                   ᮤঠ騥 ᨬ ஡  ⠡樨.  ,  
                   뫮   ॢ ⪨, 頥  s.

頥        ᯥ譮 襭, 㭪 gets 頥
祭           ப s;  ⨦  䠩 (EOF) 
                   訡 頥 NULL.

७ᨬ      㭪樨 ন       ⥬   UNIX   
                   ⠭⮬  ANSI  C.  㭪     ᮢ⨬   
                   Windows.

 ⠪     cgets, ferror, fgets, fopen, fputs, fread, getc,
                   puts, scanf.


ਬ:

#include <stdio.h>

int main(void)
{
    char string[133];
    printf(" ப:");
    gets(string);
    printf("Cப = '%s'\n,string);
}


gettext

㭪             ⥪  ࠭   (ࠡ⠥ 
                   ⥪⮢ ०).

⠪          #include<conio.h>
                   int gettext(int left, int top, int right,
                               int bottom, void *destin);

 ᮤঠ騩    conio.h
⨯

ᠭ           gettext   ᮤন  אַ㣮쭨  
                   ⥪⮢   ࠭      ࠧࠬ,  ।塞묨
                   ࠬࠬ left,  top,  right,  bottom,  
                   ,   㪠뢠 ࠬ destin.

                    न   ᮫묨  न⠬
                   ࠭,   ⭮⥫묨  ᨬ  .
                    孨 㣮  न (1,1).

                   gettext 뢠        ᮤন         ࠭
                   ᫥⥫쭮 ᫥ ࠢ  ᢥ .

                        ࠭  ॡ  ࠭ 2
                   :    -   ᨬ   ன  -
                     ਡ.  ..    ࠭ אַ㣮쭨
                   ਭ w  ⮩ h ॡ h*w*2 .

頥        砥 ᯥ譮 襭 gettext 頥
祭           1.  砥  訡  (᫨  ,  ਬ,  
                   न,   室騥     ।  ࠭  
                    ०)  頥 0.

७ᨬ      gettext ࠡ⠥ ⮫쪮  ⥬ ᮢ⨬ 
                   IBM PC    ᮢ⨬      BIOS.   㭪   
                   ᮢ⨬  Windows.

 ⠪     movetext, puttext.

ਬ:

#include<conio.h>

char buffer[4096];

int main(void)
{
   int i;
   clrscr();
   for(i=0; i<=20; i++)
      cprintf("ப #%d\r\n",i);
   gettext(1,1,80,25,buffer);
   gotoxy(1,25);
   cprintf(" 㫥 ࠭   ...\n");
   getch();
   clrscr();
   gotoxy(1,25);
   cprintf(" ⠭ ࠭  ...\n");
   getch();
   puttext(1,1,80,25);
   gotoxy(1,25);
   cprintf(" 襭   ...\n");
   getch();
   return 0;
}


gettextinfo

㭪            砥 ଠ  ⥪⮢ ०.

⠪          #include<conio.h>
                   void gettextinfo(struct text_info *r);

, ᮤঠ騩   conio.h
⨯

ᠭ           gettextinfo   ⨯ text_info, 
                      㪠뢠   ࠬ  r,  ଠ樥  
                   ⥪饬 ⥪⮢ ०.

                   text_info ।  conio.h ᫥騬 ࠧ:

                   struct text_info {
                      unsigneg char winleft;   /* .  */
                      unsigneg char wintop;    /*. 設  */
                      unsigneg char winright;  /* ࠢ .  */
                      unsigneg char winbottom; /*  .  */
                      unsigneg char attribute; /* ਡ ⥪ */
                      unsigneg char normattr;  /* ଠ ਡ */
                      unsigneg char currmode;  /* BW40, BW80, C40 
                                                                 80 */
                      unsigneg char screenheight; /* bottom - top */
                      unsigneg char screenwight;  /* right - left */
                      unsigneg char curx;    /*  - .  */
                      unsigneg char cury;    /* y - .  */
                   };

頥       gettextinfo 頥 १  ࠬ r.
祭

७ᨬ      gettextinfo ࠡ⠥   ⮫쪮       ,
                   ᮢ⨬    IBM  PC.  㭪   ᮢ⨬ 
                   Windows.

 ⠪     textattr, textbackground, textcolor, textmode,
                   wherex, wherey, window.

ਬ:

#include<conio.h>

int main(void)
{
   struct text_info ti;
   gettextinfo(&ti);
   cprintf(" ࠭:       %2d\r\n",ti.winleft);
   cprintf(" ࠭:     %2d\r\n",ti.wintop);
   cprintf("ࠢ ࠭:      %2d\r\n",ti.winrigth);
   cprintf(" ࠭:      %2d\r\n",ti.winbottom);
   cprintf("ਡ:            %2d\r\n",ti.attribute);
   cprintf("ଠ ਡ: %2d\r\n",ti.normattr);
   cprintf("騩 ०:       %2d\r\n",ti.curmode);
   cprintf(" ࠭:       %2d\r\n",ti.screenheight);
   cprintf("ਭ ࠭:       %2d\r\n",ti.screenwidth);
   cprintf("न :        %2d\r\n",ti.curx);
   cprintf("न y:        %2d\r\n",ti.cury);
   return 0;
}


gettextsettings

㭪            砥 ଠ  ⥪饬 ᪮ .

⠪          #include <graphics.h>
                   void var gettexsettings(struct
                        textsettingstype far *texttypeinfo);


, ᮤঠ騩   graphics.h
⨯

ᠭ           gettextsettings                 
                   textsettingstype,     㪠뢠 textinfo,
                   ଠ樥       ⥪饬    ⥪⮢    ,
                   ࠢ, ࠧ  ࠢ.

                    textsettingstype,           ᯮ㥬
                   gettextsettings, ।  graphics.h ᫥騬
                   ࠧ:

                   struct textsettingstype{
                    int font;
                    int direction;
                    int charsize;
                    int horiz;
                    int vert;
                    };

                    settextstyle,      ன    ᮤন
                   ᠭ  .

頥       .
祭

७ᨬ      㭪 㭨쭠    Borland C++.   ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨   ०.   㭪     ᮢ⨬  
                   Windows.

 ⠪     outtext, outtextxy, registerbgifont,
                   settextjustify, settextstyle,
                   setusercharsize, textheight, textwidth.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

/*  ন ⮢ */
char *font[] = {"DEFAULT_FONT",
                "TRIPLEX_FONT",
                "SMALL_FONT",
                "SANS_SERIF_FONT",
                "GOTHIC_FONT"
                };
/*  ࠢ ⥪ */
char *dir[] = {"HORIS_DIR","VERT_DIR"};

/* ਧ⠫쭮 ࠢ ⥪ */
char *hjust[] = {"LEFT_TEXT","CENTER_TEXT","RIGTH_TEXT"};

/* ⨪쭮 ࠢ ⥪ */
char *vjust[] = {"BOTTOM_TEXT","CENTER_TEXT","TOP_TEXT"};

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
struct textsettingstype textinfo;
int midx,midy,ht;
char fontstr[80],dirstr[80],sizestr[80];
char hjuststr[80],vjuststr[80];

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
midx = getmaxx()/2;
midy = getmaxy()/2;
/*  ଠ  ⥪饬  */
gettextsettings(&textinfo);
/* ८ࠧ ଠ  ப */
sprintf(fontstr,": %s",font[textinfo.font]);
sprintf(dirstr,"ࢫ: %s",dir[textinfo.direction]);
sprintf(sizestr,": %d",textinfo.charsize);
sprintf(hjuststr,"ਧ⠫쭮 ࠢ: %s",
         hjust[textinfo.horiz]);
sprintf(hjuststr,"⨪쭮 ࠢ: %s",
         hjust[textinfo.vert]);
/* 뢥 ଠ */
ht = textheight("W");
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(midx,midy,fontstr);
outtextxy(midx,midy+2*ht,direstr);
outtextxy(midx,midy+4*ht,sizestr);
outtextxy(midx,midy+6*ht,hjuststr);
outtextxy(midx,midy+8*ht,vjuststr);
/* ⪠ */
getch();
closegraph();
return 0;
}


gettime

㭪            砥 ⥬ ६.

⠪          #include <dos.h>
                   void gettime(struct time * timep);

, ᮤঠ騩   dos.h
⨯

ᠭ           㭪 gettime        time   
                       㪠뢠   ࠬ   timep,   ⥪騬
                   ⥬ ६.

                    time । ᫥騬 ࠧ:

                   struct time {
                       unsigned char ti_min;   /*  */
                       unsugned char ti_hour;  /*  */
                       unsigned char ti_hund;  /*   ᥪ㭤 */
                       unsigned char ti_sec;   /* ᥪ㭤 */
                   };

頥       .
祭

७ᨬ      gettime 㭨쭠  DOS.

 ⠪     getdate, setdate, settime, stime, time.

ਬ:

#include<stdio.h>
#include<dos.h>

int main(void)
{
   struct time t;
   gettime(&t);
   printf("६: %2d:%02d:02d.%02d\n",t.ti_hour,t.ti_min,
           t.ti_sec, t.ti_hung);
   return 0;
}


getvect

㭪            砥  뢠.

⠪          #include<dos.h>
                   void interrupt(*getvect(int intr_num))();

, ᮤঠ騩   dos.h
⨯

ᠭ             ᥬ⢠ ஢ 8086 ᮤন 
                   ஢ 뢠,  ஭㬥஢  0  255.
                   4-  ⮢ 祭    ,
                      ஬   ᯮ   㭪    ࠡ⪨
                   뢠.

                   㭪 getvect  뢠  祭      
                   ஬ intr_num        ⠭
                   祭,   "쭨"  㪠⥫  (  ਡ⮬
                   "far")    㭪 뢠.  ࠬ
                   intr_num   祭  0  255.


頥       㭪 getvect 頥 4- ⮢ 祭,
祭           ࠭饥   뢠  ஬
                   intr_num.

७ᨬ      㭪 㭨쭠  DOS.

 ⠪     disable, enable, geninterrupt, setvect.

ਬ

#include<stdio.h>
#include<dos.h>

void interrupt get_out(); /* ⨯ -樨 ࠡ⪨ 뢠 */
void interrupt (*oldfunc)(); /* 㪠⥫  뢠 */
int looping = 1;

int main(void)
{
   puts(" <Shift><Ptr Sc>  襭");
   /* ࠭   */
   oldfunc = getvect(5);
   /* ⠭   */
   setvect(5,get_out)
   /* 祣   */
   while(looping);
   /* ⠭   */
   setvect(5,oldfunc);
   puts("ᯥ譮");
   return 0;
}
void interrupt get_out()
{
   looping = 0; /*  祭 쭮 ६ */
}


getverify

㭪            砥 ﭨ 䫠 ஢ન.

⠪          #include<dos.h>
                   int getverify(void);

, ᮤঠ騩   dos.h
⨯

ᠭ           㭪 getverify   砥   ⥪饥   ﭨ
                   䫠 ஢ન.

                    ஢ન  ஫  뢮  .  
                   ஢ઠ 몫祭,                 
                   ஫,  ᫨    ஢ઠ 祭,  
                   樨         ஫   (
                   ࠭⨨ ࠢ쭮  ).

頥       㭪 getverify 頥 ⥪饥 ﭨ
祭           䫠 ஢ન,  0,  1.

                   祭 0 = ஢ઠ 몫祭 (off);
                   祭 1 = ஢ઠ 祭 (on).

७ᨬ      㭪 㭨쭠  DOS.

 ⠪     setverify.

ਬ:

#include<stdio.h>
#include<dos.h>

int main(void)
{
   if(getverify())
      printf(" 䨪樨 祭\n");
   else
      printf(" 䨪樨 몫祭\n");
   return 0;
}


getviewsettings

㭪            砥 ଠ  ⥪饩  ᬮ.

⠪          #include <graphics.h>
                   void var getviewsettings(struct
                    viewporttype far *viewport);

, ᮤঠ騩   graphics.h
⨯

ᠭ           getviewsettings    viewporttype,
                     㪠뢠 ࠬ viewport ଠ樥
                       ⥪饩        ᬮ.    
                   viewporttype ᯮ㥬 getviewport । 
                   graphics.h ᫥騬 ࠧ:

                    struct viewporttype {
                    int left, top, right, bottom;
                    int clip;
                    };


頥       .
祭

७ᨬ      㭪 㭨쭠    Borland C++.   ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨   ०.   㭪     ᮢ⨬  
                   Windows.

 ⠪     clearviewport, getx, gety, srtviewport.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

char *clip[] = {"OFF","ON"};

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
struct viewporttype viewinfo;
int midx,midy,ht;
char topstr[80],botstr[80],clipstr[80];

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
midx = getmaxx()/2;
midy = getmaxy()/2;
/*  ଠ  ⥪饩  ᬮ */
getviewsettings(&viewinfo);
/* ८ࠧ ଠ  ப */
sprintf(topstr," 孨 㣮(%d,%d)",viewinfo.left,
       viewinfo.top);
sprintf(botstr,"ࠢ  㣮(%d,%d)",viewinfo.rigth,
       viewinfo.bottom);
sprintf(clipstr,"஢: %s",clip[viewinfo.clip]);
/* 뢥 ଠ */
ht = textheight("W");
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(midx,midy,topstr);
outtextxy(midx,midy+2*ht,botstr);
outtextxy(midx,midy+4*ht,clipstr);
/* ⪠ */
getch();
closegraph();
return 0;
}


getw

㭪              ⮪ 楫 ᫮.

⠪          #include <stdio.h>
                   int getw(FILE *stream);

, ᮤঠ騩   stdio.h
⨯

ᠭ           getw 頥   ᫥饥  楫    㪠
                   ⮪.         ࠧ㬥      
                   ࠢ    䠩.  getw  ᯮ짮,
                    ⮪   ⥪⮢ ०.

頥       getw 頥 ᫥饥 楫  室 ⮪
祭            訡    䠩  頥 EOF.
                   T.. EOF    ⨬  祭,   
                   ।  訡      䠩  室
                   ᯮ짮 㭪樨 feof  ferror.

७ᨬ      getw ন ⥬ UNIX.

 ⠪     putw.

ਬ:

#include<stdio.h>
#include<stdlib.h>

#define FNAME "test.$$$"

int main(void)
{
   FILE *fp;
   int word;
   /*   䠩 ᫮ */
   fp = open(FNAME,"wb");
   if(fp==NULL)
   {
      printf("訡  ⨨ 䠩\n");
      exit(1);
   }
   word = 94;
   putw(word,fp);
   if(ferror(fp))
      printf("訡,    䠩\n");
   else
      printf("ᯥ譠   䠩\n");
   fclose(fp);
   /* ୮ ⨥ 䠩 */
   fp = fopen(FNAME,"rb");
   if(fp==NULL)
   {
      printf("訡  ⨨ 䠩%s\n",FNAME);
      exit(1);
   }
   word = getw(fp);
   if(ferror(fp))
      printf("訡,  ⥭  䠩\n");
   else
      printf("ᯥ譮 ⥭  䠩, word = %d\n",word);
   fclose(fp);
   unlink(FNAME);
   return 0;
}


getx

㭪            頥 न x ⥪饩 ᪮
                   樨.

⠪          #include <graphics.h>
                   int far getx(void);

, ᮤঠ騩   graphics.h
⨯

ᠭ           getx 室  न  x  ⥪饩   ᪮
                   樨.  祭    ⭮⥫쭮  ⥪饩
                    ᬮ.

頥       getx 頥 न x ⥪饩 樨
祭

७ᨬ      㭪 㭨쭠    Borland C++.   ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨  ०.  㭪      ᮢ⨬   
                   Windows.

 ⠪     getmaxx, getmaxy, getviewsettings, gety, moveto.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
char message[80];

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}

/* ६   業 ࠭ */
moveto(getmaxx()/2,getmaxy()/2);
/* ᮧ ப */
sprintf(message,"<-(%d,%d)",getx(),gety());
outtext(message);
/* ⪠ */
getch();
closegraph();
return 0;
}


gety

㭪            頥 न y ⥪饩 ᪮
                   樨.

⠪          #include <graphics.h>
                   int far gety(void);

, ᮤঠ騩   graphics.h
⨯

ᠭ           gety 室  न  y  ⥪饩   ᪮
                   樨.  祭    ⭮⥫쭮  ⥪饩
                    ᬮ.

頥       gety 頥 न y ⥪饩 樨
祭

७ᨬ      㭪 㭨쭠    Borland C++.   ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨  ०.  㭪      ᮢ⨬   
                   Windows.

 ⠪     getmaxx, getmaxy, getviewsettings, getx, moveto.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
char message[80];

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}

/* ६   業 ࠭ */
moveto(getmaxx()/2,getmaxy()/2);
/* ᮧ ப */
sprintf(message,"<-(%d,%d)",getx(),gety());
outtext(message);
/* ⪠ */
getch();
closegraph();
return 0;
}


gmtime

㭪            ८ࠧ   ६  ६  ⠭
                   ਭ.

⠪          #include <time.h>
                   struct tm *gmtime(long *timer);

, ᮤঠ騩   time.h
⨯

ᠭ           gmtime 砥     祭,   頥
                   㭪樥 time,  頥 㪠⥫  
                   ⨯  tm,  ᮤঠ  ࠧ  ६.  gmtime
                   ८ࠧ ६ ।⢥  ਭ.

                   쭠 ६ ⨯  long  timezone  
                   ᮤঠ  ࠧ    ᥪ㭤   ६ 
                   ਭ   ६. 쭠 ६
                   daylight   ࠢ 0, ᫨  ᯮ
                   ⠭⭮ ⭥ ६.

                    tm         time.h   ᫥騬
                   ࠧ:

                   struct tm {
                   int tm_sec;
                   int tm_min;
                   int tm_hour;
                   int tm_mday;
                   int tm_mon;
                   int tm_year;
                   int tm_wday;
                   int tm_yday;
                   int tm_isdst;
                   };

                      ᮤঠ  ६  24-ᮢ ,
                       1-31,     1-12,      
                   (ᥭ = 0),   - 1900,    0-365 
                   䫠, ।騩   ⭥ ६.

頥       gmtime 頥 㪠⥫  , ᮤঠ-
祭            ࠧ ६.    
                    static     १뢠      
                   맮.

७ᨬ      gmtime 㯭  ⥬ UNIX  ন
                   ⠭⮬ ANSI C.

 ⠪     asctime, ctime, localtime, stime, time, tzset.

ਬ:

#include<stdio.h>
#include<stdlib.h>
#include<time.h>

char *tzstr = "TZ=PST8PDT";

int main(void)
{
   time_t t;
   struct tm *gmt,*area;
   putenv(tzstr);
   t = time(NULL);
   area = localtime(&t);
   printf("쭮 ६:%s\n",asctime(area));
   gmt = gmtime(&t);
   printf("GMT:%s\n",asctime(gmt));
   return 0;
}


gotoxy

㭪            樮   ⥪⮢ .

⠪          #include<conio.h>
                   void gotoxy(int x, int y);

, ᮤঠ騩   conio.h
⨯

ᠭ           gotoxy ६頥        ⥪⮢    
                   㪠   .   ᫨   न   㪠
                   ୮,   맮      㭪樨  .
                   ਬ,   ந  맮 gotoxy(40,30)
                      ࠧ 35  25.

頥       .
祭

७ᨬ      gotoxy ࠡ⠥ ⮫쪮  ⥬,  ᮢ⨬ 
                   IBM PC.  筠  㭪   Turbo Pascal.
                   㭪  ᮢ⨬  Windows.

 ⠪     wherex, wherey, window.

ਬ:

#include<conio.h>

int main(void)
{
   clrscr();
   gotoxy(35,12);
   cprintf("ਢ!");
   getch();
   return 0;
}


graphdefaults

㭪            ⠭  ᪨ ࠬ  
                   砫 祭.

⠪          #include <graphics.h>
                   void far graphdefaults(void);

, ᮤঠ騩   graphics.h
⨯

ᠭ           graphdefaults ⠭     ᪨
                   ࠬ   砫 祭:

                   - ⠭  ᬮ   ࠭.

                   - ६頥 ⥪   (0,0).

                   - ⠭ 砫 梥 , 梥 䮭
                      梥 뢮.

                   - ⠭ 砫 ⨯  蠡 .

                   - ⠭ 砫   ࠢ.

頥       .
祭

७ᨬ      㭪 㭨쭠  Borland  C++.    ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨  ०.  㭪      ᮢ⨬   
                   Windows.

 ⠪     initgraph, setgraphmode.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
int maxx, maxy;

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
maxx = getmaxx();
maxy = getmaxy();
/* 뢥   ᢮ ࠬࠬ */
setlinestyle(DOTTED_LINE,0,3);
line(o,o,maxx,maxy);
outtextxy(maxx/2,maxy/2,"। ⠭ 室 祭");
getch();
/* ⠭ 室 祭  ࠬ஢ */
graphdefaults();
cleardevice();
/* 뢥 ப  室묨 ࠬࠬ */
line(o,o,maxx,maxy);
outtextxy(maxx/2,maxy/2,"᫥ ⠭ 室 祭");
/* ⪠ */
getch();
closegraph();
return 0;
}


grapherrormsg

㭪            頥 㪠⥫      ப   ᮮ饭  
                   訡.

⠪          #include <graphics.h>
                   char *far grapherrormsg(int errorcode);

, ᮤঠ騩   graphics.h
⨯

ᠭ           grapherrormsg 頥   㪠⥫      ப
                   ᮮ饭    訡,  易    errorcode  -
                   祭, 頥 graphresult.

                      ᠭ  errno ( 3 "
                   ६")    ᯨ᪮ 訡  
                    .

頥       grapherrormsg 頥 㪠⥫  ப
祭           ᮮ饭  訡.

७ᨬ      㭪 㭨쭠    Borland C++.   ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨   ०.   㭪     ᮢ⨬  
                   Windows.

 ⠪     graphresult.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

#define NONSENSE -50

int main(void)
{
/* 樠 訡 */
int graphdriver = NONSENSE, gmode, errorcode;

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();

/* 뤠 ᮮ⢥饥 訡 ᮮ饭 */
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
line(o,o,getmaxx(),getmaxy());
/* ⪠ */
getch();
closegraph();
return 0;
}


_graphfreemem

㭪            짮⥫ ᢮  .

⠪          #include <graphics.h>
                   void far _graphfreemem(void var
                    *ptr,unssigned size);

, ᮤঠ騩   graphics.h
⨯

ᠭ           ᪠ ⥪ 뢠 _graphfreemem  
                   ᢮   ,  ࠭  ⮩    
                   _graphgetmem.    ࠢ  ।
                    ᪮ ⥪ ।⢮ ⮣
                   । 襩 ᮡ⢥ ᨨ _graphfreemem
                   (    ।    ⠪,     
                   ᠭ).  砫쭠  ⮩ ࠬ  
                   뢠 free.

頥       .
祭

७ᨬ      㭪 㭨쭠  Borland  C++.    ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨   ०.   㭪     ᮢ⨬  
                   Windows.

 ⠪     _graphgetmem, setgraphbufsize.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<alloc.h>

#define NONSENSE -50

int main(void)
{
/* 樠 訡 */
int graphdriver = NONSENSE, gmode, errorcode;
int midx,midy;

/* 㫥 ⥪⮢ ࠭ */
clrscr();
printf(" 樠欬 䨪   ...");
getch();
clrscr();

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();

/* 뤠 ᮮ⢥饥 訡 ᮮ饭 */
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
midx = getmaxx()/2;
midy = getmaxy()/2;
/* 뢥 ᮮ饭 */
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(midx,midy," 室  ᪮ ०
                          ");
/* ⪠ */
getch();
closegraph();
return 0;
}
/* 뢠 ஬ ᪮ ⥬  뤥  */
void far *far _graphgetmem(unsigned size)
{
   printf("맢 _graphgetmem  뤥 %d \n",size);
   printf("  :");
   getch();
   printf("\n");
   /* 뤥  */
   return farmalloc(size);
}
/* 뢠 ஬ ᪮ ⥬  ᢮  */
void far _graphfreemem(void far *ptr, unsigned size)
{
   printf("맢 _graphfreemem  ᢮ %d \n",size);
   printf("  :");
   getch();
   printf("\n");
   /* ᢮  */
   return farfree(ptr);
}


_graphgetmem

㭪            짮⥫ 墠뢠  .

⠪          #include <graphics.h>
                   void far _graphgetmem(unsigned size);

, ᮤঠ騩   graphics.h
⨯

ᠭ           ᪠ ⥪  뢠  _graphgetmem (
                     짮⥫᪠  ணࠬ)      뤥
                         ७   ஢,   ᪨
                   ࠩ஢      ⮢.         ࠢ
                   ।      ᪮  ⥪
                   ।⢮ ⮣ । 襩 ᮡ⢥
                   ᨨ  _graphgetmem (  ।  ⠪,
                      ᠭ).  砫쭠    ⮩
                   ࠬ  뢠 malloc.

頥       .
祭

७ᨬ      㭪 㭨쭠  Borland  C++.    ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨   ०.   㭪     ᮢ⨬  
                   Windows.

 ⠪     _graphfreemem, initgraph, setgraphbufsize.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<alloc.h>

#define NONSENSE -50

int main(void)
{
/* 樠 訡 */
int graphdriver = NONSENSE, gmode, errorcode;
int midx,midy;

/* 㫥 ⥪⮢ ࠭ */
clrscr();
printf(" 樠樨 䨪   ...");
getch();
clrscr();

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();

/* 뤠 ᮮ⢥饥 訡 ᮮ饭 */
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
midx = getmaxx()/2;
midy = getmaxy()/2;
/* 뢥 ᮮ饭 */
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(midx,midy," 室  ᪮ ०
                          ");
/* ⪠ */
getch();
closegraph();
return 0;
}
/* 뢠 ஬ ᪮ ⥬  뤥  */
void far *far _graphgetmem(unsigned size)
{
   printf("맢 _graphgetmem  뤥 %d \n",size);
   printf("  :");
   getch();
   printf("\n");
   /* 뤥  */
   return farmalloc(size);
}
/* 뢠 ஬ ᪮ ⥬  ᢮  */
void far _graphfreemem(void far *ptr, unsigned size)
{
   printf("맢 _graphfreemem  ᢮ %d \n",size);
   printf("  :");
   getch();
   printf("\n");
   /* ᢮  */
   return farfree(ptr);
}



graphresult

㭪            頥     訡    ᫥     㤠筮
                   믮 ᪮ 樨.

⠪          #include <graphics.h>
                   int far graphresult(void);

, ᮤঠ騩   graphics.h
⨯

ᠭ           graphresult 頥       訡   ᫥
                   ᪮ 樨,   ᮮ騫  訡,
                    ⠭ ஢ 訡  grOk.

                    ᫥饩   ⠡   ਢ      訡,
                   頥    graphresult.   塞   ⨯
                   graph_errors । 訡     ⠡.
                   graph_errors   graphics.h.

     
            ⠭         ᮮ⢥ ப
     訡    graphics_errors    ᮮ饭  訡
     
       0    grOk                   訡
      -1    grNoInitGraph         BGI-䨪  ⠭
                                  (ᯮ initgraph)
      -2    grNotDetect            㦥 ᪨ -
                                   ।⢠
      -3    grFileNotFound        䠩 ࠩ  
      -4    grInvalidDriver       ࠢ 䠩 ࠩ
      -5    grNoLoadMem                㧪
                                  ࠩ
      -6    grNoScanMem           室    ᪠饬
                                  
      -7    grNoFloodMem          室     -
                                  
      -8    grFontNotFound        䠩  ⮬  
      -9    grNoFontMem                㧪
                                  
      -10   grInvalidMode          ᪨ ० 
                                  ࠭ ࠩ
      -11   grError               ᪠ 訡
      -12   grIOError             ᪠ 訡 /뢮
      -13   grInvalidFont          ⮢ 䠩
      -14   grInvalidFontNum        
      -15   grInvalidDeviceNum      ன⢠
      -18   grInvalidVersion        ᨨ
     ------------------------------------------------------------

                   ⨬,    ६,  祭    graph-
                   result,  ⠭  0 ᫥  襭
                   맮  graphresult.  ⮬ 室 ࠭
                   祭,  祭      graph-   result,   
                   ६ ६  ⥬  ᯮ짮.

頥       graphresult 頥 ⥪騩  -
祭           ᪮ 訡 - 楫 ᫮  -15  0;
                   grapherrormsg 頥   㪠⥫     ப,
                   易    祭,  頥   㭪樥
                   graphresult.

७ᨬ      㭪 㭨쭠  Borland  C++.    ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  ,
                   ᭠饭 ᯫ묨 ࠬ, ন騬
                   ᪨  ०.  㭪      ᮢ⨬   
                   Windows.

 ⠪      detectgraph, drawpoly, fillpoly, floodfill,
                    grapherrormsg, initgraph, pieslice,
                    registerbgidriver, registerbgifont,
                    setallpalette, setcolor, setfillstyle,
                    setgraphmode, setlinestyle, setpalette,
                    settextjustify, settextstyle, setusercharsize,
                    setviewport, setvisualpage.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/* ॡ ⮮। */
int graphdriver = DETECT, gmode, errorcode;

/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
line(o,o,getmaxx(),getmaxy());
/* ⪠ */
getch();
closegraph();
return 0;
}
