
sbrk

㭪             ࠧ饭 ᥣ   .

⠪          #include<alloc.h>
                   char *sbrk(int incr);

, ᮤঠ騩   alloc.h
⨯

ᠭ           㭪 sbrk      饬  祭
                   incr ,   ᮮ⢥⢥ 뤥 . incr
                      ⥫,   ⮬  砥  ꥬ
                   뤥  㬥蠥.

                    砥 ᫨   뤥    筮
                   ᢮ ,  sbrk 蠥  訡  
                   ந  ⢨.

頥        ᯥ譮 襭 sbrk 頥 ஥
祭           祭.  訡, sbrk 頥 -1 
                   쭮 ६ errno ᢠ 祭:

                   ENOMEM - 筮 .

७ᨬ      sbrk 㯭      ⥬   UNIX.   㭪  
                   ᮢ⨬  Windows.

 ⠪     brk.

ਬ:

#include<stdio.h>
#include<alloc.h>

int main(void)
{
   printf(" 뤥 ꥬ    sbrk\n");
   printf("। 맮 sbrk ᢮ %lu .\n",
          (unsigned long)coreleft());
   sbrk(1000);
   printf("᫥ 맮 sbrk ᢮ %lu .\n",
          (unsigned long)coreleft());
   return 0;
}


scanf

㭪            믮 ଠ஢   ⮪ stdin.

⠪          #include<stdio.h>
                   int scanf(const char *format [,adress, ...]);

, ᮤঠ騩   stdio.h
⨯

ᠭ           㭪 scanf  ᬠਢ 室 ,  ᨬ
                    ᨬ,  뢠   ⮪  stdin.  ⥬
                         ଠ    ᮮ⢥⢨  
                   ᯥ䨪樥    ଠ,    ।    scanf
                   㬥⮬  format.  ᫥  ⮣    뢠
                   ଠ஢      ᠬ,   
                   㬥⠬,   ᫥騬    ଠ⭮  ப.
                   ᫮ ᯥ䨪権 ଠ   ᮮ⢥⢮
                    ᮢ.

                             ப ଠ.

                   ப ଠ,        맮
                   㭪権 ᥬ⢠ ...scanf,  ࠢ ⥬,  
                   ࠧ       㭪    㤥    뢠,
                   ८ࠧ뢠    뢠  室 .  
                      ᯥ䨪権   ଠ       
                   筮  ⢮  㬥⮢;  ᫨
                         ᮡ,   १      
                   ।᪠㥬   ,  ⭮  訡.  譨
                    㬥 (,  祬  ॡ  ଠ)
                    ஢.

                   ਬ砭. scanf  ਢ  ।᪠㥬
                   १⠬,     ⪫    筮
                   蠡.  室 ,  㦭 㪠
                   scanf,     ࠧ   ᨭ஭஢   
                   ப.     १  ।⥫쭥    
                      gets    fgets,    묨
                   ᫥ sscanf.

                   ப 䮬 -  ᨬ쭠 ப,  ᮤঠ
                    ⨯ ꥪ⮢:  騥  ᨬ,  騥
                   ᨬ  ᯥ䨪樨 ଠ.

                   - 騥   ᨬ  -      (  ),  
                     ⠡樨 (\t)  ᨬ 室   ப
                     (\n).    ⮫쪮  㭪  ᥬ⢠  ...scanf
                     砥 騩 ᨬ    ப  ଠ,
                       뢠,    ࠭  ᫥騥
                     騥  ᨬ        ,      
                       騩 ᨬ.

                   - 騥  ᨬ  -    ᨬ ASCII,  
                     ᪫祭   業  (%).  ᫨  㭪
                     ᥬ⢠  ...scanf 砥  ଠ⭮ ப
                     騩 ᨬ,  뢠,   ࠭
                      ᨬ.

                   - 䨪  ଠ ࠢ ᮬ ⥭
                      ८ࠧ   室      祭
                     ᯥ樠  ⨯    뢠   ᠬ,
                     ⠢塞 묨 㬥⠬.

                   ⮢ 騥 ᨬ  ⠭묨
                   (  ᨬ  室   ப),  ᫨
                     ⨫   ப ଠ.

                            䨪樨 ଠ.

                   䨪樨 ଠ  㭪権  ...   scanf   
                   ᫥ :

                      %[*] [ਭ] [F/N] [h/l/L]  ᨬ ⨯

                   䨪 ଠ 稭   %.  ᫥
                   ⮣  ᫥  ᯥ䨪樨    ।
                   浪:

                   - 易⥫ ᨬ  祭 [*].

                   - 易⥫ ᯥ䨪 ਭ [width].

                   - 易⥫   䨪  ࠧ  㪠⥫
                     [F/N].

                   - 易⥫   䨪   ⨯    㬥
                     [h/l/L].

                   -  ⨯.

                       易⥫  ଠ⭮ ப.

                    ᫥ ᭮ ਭ樯 ଠ஢
                    ᯥ䨪 ଠ⭮ ப:


                  ࠧ  ࠢ ଠ⮬.
 ᯥ䨪    
ĳ
      *            祭 ᫥饣 室 ;
   width          ᨬ쭮 ᫮ 뢠 ᨬ; ᫨
                  㭪 ...scanf 砥 騩  ८-
                  ࠧ㥬 ᨬ,   ⠭ ⥫-
                   ᨬ;
      size        ⢥࣠   㬮砭 ࠧ ᭮
                  㬥
                  (N -  㪠⥫,
                   F - 쭨 㪠⥫)
     ⨯          ⢥࣠   㬮砭  㬥
   㬥      (h - ⪮ 楫,
                   l -  楫, ᫨ ᨬ ⨯ 㪠뢠
                       楫᫥ ८ࠧ
                   l -  筮, ᫨ ᨬ ⨯ 㪠뢠
                        ८ࠧ ᥫ  饩 窮
                   L - ,  筮 (⨬ ⮫쪮
                        ८ࠧ ᥫ  饩 窮


                    ⨯  㭪権  ...scanf.

                    ᫥饩  ⠡ ᫥ ᨬ ⨯ 
                   㭪権 ᥬ⢠ ...scanf,   ⨯  
                   ଠ,  ஬ 㤥 ࠭  .

                   ଠ     ⠡  ࠧ㬥,  
                    ᯥ䨪    䨪    뫨
                   祭    ᯥ䨪 ଠ.  ⮡ 㢨,
                    祭   ଠ    ᯥ䨪஢
                      䨪஢        ,
                   ᬮ ⠡, ᫥  :


         㬥
  ⨯                 


                           ᫮ .

  d     筮      㪠⥫  楫 (int *arg)
           楫       
  D     筮      㪠⥫   楫 (long *arg)
           楫       
  o     쬥筮    㪠⥫  楫 (int *arg)
           楫       
  O     쬥筮    㪠⥫   楫 (long *arg)
           楫       
  i     筮,     㪠⥫   楫 (long *arg)
        쬥筮   
         ⭠- 
        筮 楫 
  u     筮      㪠⥫  楫   (unsigned
        楫   int *arg)
  U     筮      㪠⥫   楫  
        楫   (unsigned long *arg)
  x     ⭠- 㪠⥫  楫 (int *arg)
         楫      
  X     ⭠- 㪠⥫   楫 (long *arg)
         楫      
  e     ᫮  - 㪠⥫  ᫮  饩 窮
        饩 窮      (float *arg)
  E     ᫮  - 㪠⥫  ᫮  饩 窮
        饩 窮      (float *arg)
  f     ᫮  - 㪠⥫  ᫮  饩 窮
        饩 窮      (float *arg)
  g     ᫮  - 㪠⥫  ᫮  饩 窮
        饩 窮      (float *arg)
  G     ᫮  - 㪠⥫  ᫮  饩 窮
        饩 窮      (float *arg)


                           .

  s     ப ᨬ 㪠⥫  ᨢ ᨬ (char arg[ ])
  c     ᨬ          㪠⥫  ᨬ (char *arg); ᫨ -
                          w    ᨬ ⨯ c
                        ( . %5c): 㪠⥫  ᨢ  w
                        ᨬ (char arg[w]);
  %     ᨬ %         ८ࠧ  ந室; ᨬ-
                         % ࠭.


                              ⥫.

  n     ()   㪠⥫  楫 (int *arg)
                         㪠⥫ ࠭ ⢮ ⠭-
                         ᨬ  %n.
  p     ⭠- 㪠⥫   ꥪ (쭨 * 
         ᫮       *).
        ଥ:          ८ࠧ %p ।ᬠਢ ⠭-
        YYYY:ZZZZ        ࠧ 㪠⥫, ਭ   -
         ZZZZ         .


                            室 .

                   室              ᫥
                   ࠦ:

                   -   ᨬ    (   ) ᫥饣 
                     浪 饣 ᨬ.

                   -  ᨬ  ࢮ  ⨢襣,  
                        ८ࠧ ⥪饩 ᯥ䨪樥
                     ଠ (⠪,  ਬ,    8  9  
                     쬥筮 ଠ).

                   -  n ᨬ,  n -   ਭ .

                                 襭.

                    ᫥   ᮣ襭,  ਭ
                    । ᯥ䨪権 ଠ.

                   ८ࠧ %c

                    ᯥ䨪       뢠    1,
                   ᫥騩  浪 ᨬ,   騥.
                   ⮡  ய    騩      
                   ᫥騩 騩 ᨬ, ᯮ %1s.

                   ८ࠧ %Wc (W - ᯥ䨪 ਭ).

                    㬥    㪠⥫   ᨢ
                   ᨬ;  ᨢ ⮨    W  ⮢  (char
                   arg[W]).

                   ८ࠧ %s

                    㬥    㪠⥫   ᨢ
                   ᨬ (char arg[]).

                    ᨢ    ࠩ    (n+1)
                   ⮢,    n  =    ப  s ( ᨬ).
                   室  稢  ஡    ᨬ
                   室      ப.    ᨬ쭮 ப
                   ⮬᪨    㫥  砭   
                   뢠,  ᫥  ᨢ.

                   ८ࠧ %[search set]

                    ᨬ,  祭    ᪮,
                         ᨬ  ⨯  s.  
                   㬥    㪠⥫   ᨢ ᨬ
                   (char arg[]).    ᪮ 祭  
                   ᨬ,      ।  "᪮  "
                    ᨬ,  ନ  ப  (室
                   ).

                   ᫨   ᨬ    ᪮  -  ᨬ (^),
                   ᪮   ⠪  ࠧ,  ⮡
                   ᮤঠ      ᨬ  ASCII  ஬  ,  
                   ᫥  묨  ᪮.  (筮,
                   ᨬ  㤥  祭    ஢ ᪮
                   ,  ᫨   㪠    ᯨ᪥  ᨬ
                   ᫥ ࢮ ).

                   室   ।⠢  ᮡ ப ᨬ,
                     ࠭祭  騬  ᨬ.  㭪樨
                   ᥬ⢠ ...scanf  뢠 室  
                     ,              ᨬ,
                   騩        ᪮       (   
                   ஢ ᪮ ).    ਢ
                    ਬ  ⨯ ८ࠧ:

                   %[abcd] 㤥 ந   室 
                              ᨬ a, b, c, d.

                   %[^abcd] 㤥 ந   室
                              ᨬ, ஬ a, b, c, d.

                       ⠪ 㪠  (ᥫ 
                   ᨬ).   ⪠  .    ਬ  
                   ᪠  筮     室 ⮪ 
                   㪠:

                    %[0123456789]

                    ⮦ ᠬ,  :

                    %[0-9]

                    ᪠   ᨬ         ᯮ짮
                   ᫥騥 ᮪饭:

                    %[A-Z]             ᨬ 孥 ॣ
                    %[0-9A-Za-z]           ᨬ-
                                       ( 孥   -
                                      ).
                    %[A-FT-Z]          ᨬ 孥 ॣ
                                       A  F  c T  Z

                    ⠪     ᮪饭           室
                   ਤন ᫥ ࠢ:

                   -    ।騩    (-)    
                     ᪨  ᨬ,  室饣  ࠢ
                     ;

                   -              ,  
                     ᫥   ᨬ.  ᫨   
                     ᫥,      ᬠਢ    
                     ᨬ,    㪠⥫ .

                   -  騥 ﬨ  (..  ᫥
                       ࠢ    )    室  㣮
                     .

                    ਢ  ᪮쪮  ਬ஢,      
                   ᨬ    㯠      ⢥ 㪠⥫
                   ,   ⢥ 筮 ᨬ.

                    %[-+*/]            䬥᪨ 樨
                    %[z-a]             z, -  a.
                    %[+0-9-A-Z]        +  -   
                                      0  9   A  Z
                    %[+0-9A-Z-]        ᨬ +  -  
                                       0  9   A  Z
                    %[^-0-9+A-Z]       ᨬ, ᪫ +  - 
                                      ᨬ    0  9 
                                       A  Z


                   ८ࠧ %e,  %E,  %f,  %g,  %G ( 饩
                   窮.

                   ᫠  饩 窮   室    
                   ᮮ⢥⢮ ᫥饬 ଠ:

                   [+/-]ddddddddd [.]dddd [E|e] [+/-]ddd,

                    祭    ᪮ 砥
                      易⥫쭮,       ddd-    ।⠢
                   ,   쬥      ⭠
                   .

                   ஬ ⮣ +INF,  -INF,  +NAN,  -NAN ᯮ
                     ᫠ ᯫ饩 窮  ⮬  
                   ᢮ 易⥫쭮 (INF  -  ᪮筮,
                   NAN -  ᫮).

                   ८ࠧ %d,%i,%o,%x,%D,%I,%O,%X,%c,%h.

                       ८ࠧ,      ஬  ࠧ襭
                   㪠⥫  ᨬ,  楫,   楫, 
                     ᯮ짮  㪠⥫  ᨬ  ,
                   楫  ,  楫  .

                     ᢮.

                     祭   窠
                   (*);   ⠩  ᨬ 樨  몥 
                   (⠪ 窠).

                   ᫨  ᨬ  (*)  ᫥      %  
                   ᯥ䨪樨 ଠ, ᫥饥 室  㤥
                   ⠭,    㤥  ᢮  ᮮ⢥饬
                   ᭮     㬥.    ।,    
                   塞  室     ᮮ⢥   ⨯,
                      ᫥      ᨬ   *.   筮
                   ᨬ쭮 ᮮ⢥⢨   ᢮ 
                   易  ᮡ ।⢥.

                   䨪 ਭ.

                   䨪 ਭ    (n),    筮   楫,
                   ஫ ᨬ쭮 ᫮ ᨬ,  ஥
                   㤥 ⠭  ⥪饣 室 .

                   ᫨ 室     ᮤন    n  ᨬ,
                   㭪樨 ᥬ⢠  ...scanf      ᨬ
                     ,  ⥬ ३  ᫥饬  
                   ᮮ⢥饩  ᯥ䨪樨 ଠ.

                   ᫨  ⮣,    㤥  ⠭  n  ᨬ,
                     騩 ᨬ  㥬
                   ᨬ,    ᨬ    ⠭ 
                   ८ࠧ, ⥬ 㭪 ३  ᫥饬
                     ᯥ䨪樨 ଠ.

                   㥬 ᨬ ⠥ ⠪  ᨬ,
                        ८ࠧ  ᮮ⢥⢨
                     ᯥ䨪樥 ଠ (ਬ,  ᨬ
                   8  9  ᬥ筮 ଠ,  ᨬ J 
                   K  ⭠筮  筮 ଠ).


 䨪     ᯥ䨪 ਭ   ࠭塞
  ਭ         .

     n          n  ᨬ 㤥 ⠭, ८ࠧ  -
               ᠭ  ⥪騩  㬥.


                   䨪 ࠧ   ⨯ 㬥.

                   䨪 ࠧ    (N     F)      ⨯
                   㬥 (h,l  L) 뢠 ﭨ  , 
                   ࠧ    㭪樨     ...scanf     
                   ᮮ⢥騥  㬥 arg.

                   䨪 F    N ⢥࣠  ⠭⭮
                     ࠧ 㬥 arg.

                   䨪 h,  l    L  ,     ⨯
                   ८ࠧ  㤥 ᯮ짮  ᫥
                     室    (h-  ⪮  楫,  l-
                     楫,  L  -     筮).
                   室   ८ࠧ   ⨯,
                    㬥 arg  室  㤥 ᮢ
                   ꥪ ᮮ⢥饣 ࠧ ("⪨" ꥪ
                     %h      筮 ꥪ 
                   %l  %L).


 䨪          ८ࠧ

     F        ⢥࣠   㬮砭   ࠧ-
              ;
              arg ,  쭨 㪠⥫.
     N        ⢥࣠   㬮砭   ࠧ-
              ;
              arg ,   㪠⥫.
               ᢥ塮让    ᯮ짮  
               ८ࠧﬨ.
     h         ⨯ d,i,o,u,x:    ⪮ -
              , 뢠  "⪨" ꥪ.
               ⨯ D,I,O,C,X:  뢠 ﭨ.
               ⨯ e,f,c,s,n,p:  뢠 ﭨ.
     l         ⨯ d,i,o,u,x: ८ࠧ    楫,
              뢠  "" ꥪ.
               ⨯ e,f: ८ࠧ   ᫮  -
              , 뢠  ꥪ  筮.
               ⨯ D,I,O,U,X:  뢠 ﭨ.
               ⨯ c,s,n,p:  뢠 ﭨ.
     L         ⨯ e, f, g: ८ࠧ   
                筮,  ࠭   ꥪ 
              ⥬  ⨯.  ⠫ ଠ ﭨ  -
              .


                    㭪樨 ...scanf ४ 뢠.

                   㭪樨 ᥬ⢠    ...scanf      ४
                   뢠   ।   室       
                   ⨦  ଠ쭮     (騩
                   ᨬ),    뢠       
                   ।  ( ࠧ 稭).

                   㭪樨 ...scanf   ४  뢠,  
                   ⥪饥    ३    ࠡ⪥  ᫥饣
                     ᫥ :

                   -     ᢮  (*)  
                     ᯥ䨪樨 ଠ  ᫥    業  %;
                     ⥪饥  뢠,   .

                   - ⠭  width  ᨬ  (width  - ᯥ䨪
                     ਭ, ⥫쭮 筮 楫).

                   - 騩  ⠭  ᨬ         
                     ஢  饬 ଠ (ਬ,
                     ᨬ A, ᫨ ଠ-).

                   - 騩   ⠭   ᨬ   室   
                       "᪮"  (, ,
                           ஢   "᪮"
                     ).

                           㭪権   ...scanf   ४頥
                   뢠 ⥪饣  室        
                   襮ᠭ    稭,    ࠧ㬥,   
                   ᫥騩 ⠭ ᨬ 㤥  ᨬ
                   ᫥饣  室  ,      ᨬ
                   ᫥饩 樨 ⥭.

                   㭪樨 ᥬ⢠ ...scanf 稢 ᢮ ࠡ
                    ᫥ :

                   - 騩    浪  ᨬ  室  
                     ᮮ⢥  ⭮饬       饬
                     ᨬ  ப ଠ.

                   - 騩 ᨬ  室  - EOF.

                   - ப ଠ ௠.

                   ᫨        ப       ଠ       
                   ᫥⥫쭮 ᨬ,    
                   ᯥ䨪樨   ଠ,      ᮢ  
                   ⥪襩  ᫥⥫쭮   ᨬ   室
                   ; 㭪樨 ...scanf 뢠,    ࠭
                   ᮢ騥 ᨬ.  砥 䫨
                   ᨬ,    ⠥    室  ,    
                   ⠭.

頥       㭪 scanf  ⢮ ᯥ譮 -
祭           ⠭, ८ࠧ   室 -
                   ; 頥  祭    砥    ᥡ
                   ⠭ ,   뫨 ࠭.

                   ᫨     㭪権   ⥭
                     䠩 (EOF),  頥 祭 㤥
                   EOF.

                   ᫨  뫮 ᠭ   , 頥
                   祭 0.

७ᨬ      scanf ন  ⥬ UNIX  ।
                    ⠭  ANSI  C.  ।    ୨  
                   . 㭪  ᮢ⨬  Windows.

 ⠪     atof, cscanf, fscanf, getc, printf, sscanf,
                   vfscanf, vsscanf.

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

int main(void)
{
   char label[20];
   char name[20];
   int entries = 0;
   int loop,age;
   double salary;
   struct Entry_struct
   {
      char name[20];
      int age;
      float salary;
   } entry[20];
   /*  ,  ப,   20 ᨬ */
   printf("   ࠬ: ");
   scanf("%20s",label);
   fflash(stdin); /*  室 ⮪,  砥 訡 */
   /*  ᫮ ⮢   楫 */
   printf("쪮 ⮢ ( > 20): ");
   scanf("%d",&entries);
   fflash(stdin); /*  室 ⮪,  砥 訡 */
   for(loop = 0; loop < entries; ++loop)
   {
       printf(" %d\n",loop);
       /*  , ⮫쪮 㪢  孥   ॣ */
       printf(": ");
       scanf("%[A_Za-z]",entry[loop].name);
       fflash(stdin); /*  室 ⮪,  砥 訡 */
       /*  ,  楫 ᫮ */
       printf(": ");
       scanf("%d",&entry[loop].age);
       fflash(stdin); /*  室 ⮪,  砥 訡 */
       /*  ࠧ ௫  float */
       printf("௫: ");
       scanf("%f",&entry[loop].salary);
       fflash(stdin); /*  室 ⮪,  砥 訡 */
   }
   /*  ,   ௫  ப, 楫  ᫮  -
      饩 窮, ᮮ⢥⢥ */
   printf(",  ᢮ ,   ௫.\n");
   scanf("%20s %d %lf",name,&age,&salary);
   /*    */
   printf("\n\A %s\n",label);
   printf("᫥ %s,  %d, $%15.2lf\n",name,age,salary);
   printf("-----------------------------------------------------\n");
   for(loop = 0; loop<entries; ++loop);
      printf("%4d | %20s | %5d | %15.2lf\n",
      loop+1,
      entry[loop].name,
      entry[loop].age,
      entry[loop].salary);
   printf("-----------------------------------------------------\n");
   return 0;
}


searchpath

㭪            ᬠਢ   ᪠ 䠩.

⠪          #include<dir.h>
                   char *searchpath(const char *filename);

, ᮤঠ騩   dir.h
⨯

ᠭ           㭪 searchpath        䠩 
                      filename,    ᯮ        DOS,
                   ।塞       ६   㦥   PATH.
                   ⥫                 䠩
                   頥  ⢥ 祭 㭪樨.
                   
                   砫 ᬠਢ ⥪騩  ⠫  ࠡ祣
                   ᪠.   ᫨   䠩  ⠬    ,  뢠
                   ६ 樮  ।   PATH      
                   ⠫      PATH  ᬠਢ  
                   ,   䠩  㤥        
                   㤥 ௠.

                    ⮫쪮 䠩 㤥 , 頥 ப,
                   ᮤঠ    䠩.    ப
                   ⥬      ᯮ짮  맮 㭪権
                   open  exec...  祭 㯠  䠩.

                   頥 ப    䠩  頥  
                   static         ९뢠      
                   ᫥饬 맮 㭪樨 searchpath.

頥       ᫨ 䠩 ᯥ譮 , 頥 㪠⥫
祭            ப filename,  ⨢ 砥, 㭪
                   searchpath 頥 祭 NULL.

७ᨬ      㭪 㭨쭠  DOS.

 ⠪     exec..., findfirst, findnext, spawn..., system.

ਬ:

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

int main(void)
{
   char *p;
   p = searchpath("TLINK.EXE");
   printf("  TLINK.EXE : %s\n", p);
   p = searchpath("NOTEXIST.FIL");
   printf("  NOTEXIST.FIL : %s\n", p);
   return 0;
}

뢮:
  TLINK.EXE : C:\BIN\TLINK.EXE
  NOTEXIST.FIL : (null)


sector

㭪              訢 ᪨ ᥪ.

⠪          #include <graphics.h>
                   void far  sector (int x,int y,int stangle,
                                       int endangle,int xradius,
                                       int yradius);

, ᮤঠ騩   graphics.h
⨯

祭         sector   ᪨  ᥪ    業஬ 
                   窥  न⠬  (x,y)    ਧ⠫묨  
                   ⨪묨    ࠤᠬ   xradius      yradius
                   ᮮ⢥⢥,  ⥪騬  梥⮬   㭪.   㣠
                     㣫 stangle  㣫 endangle.  
                    ⥪騬 梥⮬  訢  梥⮬  
                   蠡, ।묨 㭪ﬨ setfillstyle 
                   setfillpattern.

                     arc 뢠 ⨢ ᮢ ५,
                     0   ࠤᮢ   ᮮ⢥   3   ᠬ   
                   ࡫, 90 ࠤᮢ - 12 ᠬ  ..

                   ᫨  ६  ᥪ  訡,
                   graphresult 頥 祭 -6 (grNoScanMem).

頥       .
祭

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

 ⠪     arc, circle, ellipse, getarccoords,
                   getaspectratio, graphresult, pieslice,
                   setfillpattern, setfillstyle,
                   setgraphbufsize.

ਬ:

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

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
int midx,midy,i;
int stangle = 0,endangle = 360;
int xradius = 100,yradius = 50;

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

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

/* 横  蠡 */
for(i=EMPTY_FILL; i<USER_FILL;i++)
{
   /* । 蠡 */
   setfillstyle(i,getmaxcolor());
   /* ᮢ ᪨ ᥪ */
   sector(midx,midy,stangle,endangle,xradius,yradius);
   getch();
}

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


segread

㭪            뢠 祭 ᥣ ॣ஢.

⠪          #include <dos.h>
                   void segread(struct SREGS *segp);

, ᮤঠ騩   dos.h
⨯

ᠭ           㭪 segread    頥    ⥪騥    祭
                   ᥣ  ॣ஢     ,   㥬
                   ࠬ஬ segp.

                    맮 । ᯮ짮 ᮢ⭮ 
                   㭪ﬨ intdosx  int86x.

頥       .
祭

७ᨬ      㭪 㭨쭠  ஢ ᥬ⢠ 8086.

 ⠪     FP_OFF, intdos, int86,int86x, intdosx, MK_FP,
                   movedata.

ਬ:

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

int main(void)
{
   struct SREGS segs;
   segread(&segs);
   printf("ন ᥣ ॣ஢: \n");
   printf("CS: %X    DS: %X\n",segs.cs, segs.ds);
   printf("ES: %X    SS: %X\n",segs.es, segs.ss);
   return 0;
}


setactivepage

㭪            ⠭ ⨢ ࠭  ᪮
                   뢮.

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

, ᮤঠ騩   graphics.h
⨯

ᠭ           setactivepage  ࠭ page ⨢.  
                   ᫥騩 ᪨ 뢮  㤥  ࠢ
                     ࠭.

                   ⨢ ᪮  ࠭楩       ,
                           ࠭,        
                   易⥫쭮.    ⢠ ᪨
                   ࠭  襩 ⥬.  쪮 ᪨ 
                   EGA,  VGA     Hercules   ন   ᪮쪮
                   ࠭.

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

 ⠪     setvisualpage.

ਬ:

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

int main(void)
{
/*  ࠩ  ०,   ন */
int graphdriver = EGA, gmode = EGAHI, errorcode;
int x,y,ht;

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

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
x = getmaxx() / 2;
y = getmaxy() / 2;
ht = textheight("W");
/*   뢮   騩  ࠭ */
setactivepage(1);
/* ᮢ    */
line(0,0,getmaxx(),getmaxy());
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(x,y,"This is page #1");
outtextxy(x,y+ht,"Press any key to halt");
/*   뢮 ࠭ 0 */
setactivepage(0);
/* 뢥 ⥪  ࠭ 0 */
outtextxy(x,y,"This is page #0");
outtextxy(x,y+ht,"Press any key to view page #1");
getch();
/* ᤥ ࠭ 1  */
setvisualpage(1);

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


setallpalette

㭪               ᮪.

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

, ᮤঠ騩   graphics.h
⨯

ᠭ           setallpalette ⠭   ⥪     
                   祭,       palettetype,  
                     㪠뢠  ࠬ  palette.
                   
                      筮 ( )  梥
                    EGA/VGA c  㭪樨 setallpalette.

                   ⠭ MAXCOLORS          palettetype
                   ᯮ㥬      setallpalette,   ।   
                   graphics.h ᫥騬 ࠧ:

                      #define MAXCOLORS 15

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

                   size - ᮤন ⢮ 梥⮢      
                   ⥪饣 ᪮ ࠩ  ⥪饬 ०.

                   colors -  ᨢ    size  ,  ᮤঠ騩  
                   ஢ 梥⮢    .  ᫨
                     ᨢ colors ࠢ -1,  梥 
                    ⮣   .

                    ᨢ    colors,     ᯮ㥬     
                   setallpalette,      ।⠢    
                   ᨬ᪨ ⠭, ।  graphics.h
                                                  
           2.6.  梥⮢.
          
                     㯭 梥⮢
          
                 CGA                         EGA/VGA
                                              .
          
          BLACK                0    EGA_BLACK              0
          BLUE                 1    EGA_BLUE               1
          GREEN                2    EGA_GREEN              2
          CYAN                 3    EGA_CYAN               3
          RED                  4    EGA_RED                4
          MAGENTA              5    EGA_MAGENTA            5
          BROWN                6    EGA_LIGHTGRAY          7
          LIGHTGRAY            7    EGA_BROWN             20
          DARKGRAY             8    EGA_DARKGRAY          56
          LIGHTBLUE            9    EGA_LIGHTBLUE         57
          LIGHTGREEN          10    EGA_LIGHTGREEN        58
          LIGHTCYAN           11    EGA_LIGHTCYAN         59
          LIGHTRED            12    EGA_LIGHTRED          60
          LIGHTMAGENTA        13    EGA_LIGHTMAGENTA      61
          YELLOW              14    EGA_YELLOW            62
          WHITE               15    EGA_WHITE             63
          

                   ⨬,  梥   ⥪ ᪮
                   ࠩ  ᪮ ०.

                   , ந  , ࠧ  
                     㢨    ࠭.     梥 
                   ,    ࠭,  襭    梥,
                   ⠭ 襭   梥.

                   砭. setallpalette   ᯮ짮 
                   ࠩ஬ IBM-8514.

頥       ᫨  setallpalette । 訡筮
祭           祭, graphresult  -11(grError) 
                   ⥪  ⠭  .

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

 ⠪     getpalette, getpalettesize, graphresult,
                   setbkcolor, setcolor, setpalette.

ਬ:

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

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
struct palettetype pal;
int color,maxcolor,ht;
int y=10;
char msg[80];

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

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
maxcolor = getmaxcolor();
ht = 2*textheight("W");
/*    */
getpalette(&pal);
/* 뢥 祭 梥⮢  */
for(color = 1; color <= maxcolor; color++)
{
   setcolor(color);
   sprintf(msg,"Color %d",color);
   outtextxy(1,y,msg);
   y += ht;
}
/*    */
getch();
/* ᢮ ᥬ [梥⠬ 祭 ୮ */
for(color = 1; color <= maxcolor; color++)
{
   setpalette(color,BLACK);
   getch();
}
/* ⠭ 梥  */
setallpalette(&pal);
/* ⪠ */
getch();
closegraph();
return 0;
}


setaspectratio

㭪             ४騩 䠪 ࠪ᪮
                   ⭮襭, ⠭  㬮砭.

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

, ᮤঠ騩   graphics.h
⨯

ᠭ           setaspectratio ᯫ           ,
                   ⠭    㬮砭  ࠪ᪮
                   ⭮襭 ᪮ ⥬.  ࠪ᪮
                   ⭮襭  ᯮ  ᪮  ⥬ 
                   ⮣,  ⮡ 㡥,    㦭  
                   㣫.   ᫨   㦭    ࠭  룫廊
                   ᮬ,    ஥.    
                   ࠢ    ⭮  ᯥ祭 ।⢮
                   ७ன ,     ᤥ
                    ࠬ ᯥ祭, ᯮ setaspectratio
                    ⠭ ࠪ᪮  ⭮襭.  
                   祭  ⥪饣  ࠪ᪮ ⭮襭
                    ⥬ 뢠 getaspectratio.

頥       .
祭

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

 ⠪     circle, getaspectratio.

ਬ:

#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());

/*  ⥪饥 ࠪ᪮ ⭮襭 */
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;
}


setbkcolor

㭪            ⠭ ⥪騩 梥 䮭, ᯮ
                   .

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

, ᮤঠ騩   graphics.h
⨯

ᠭ           setbcolor ⠭  䮭  梥,  ।塞
                   color.  㬥  color         
                   ஬,    ᫥饩 ⠡.

          
                                         
          
             0           BLACK                8     DARKGRAY
             1           BLUE                 9     LIGHTBLUE
             2           GREEN                10    LIGHTGREEN
             3           CYAN                 11    LIGHTCYAN
             4           RED                  12    LIGHTRED
             5           MAGENTA              13    LIGHTMAGENT
             6           BROWN                14    YELLOW
             7           LIGHTGRAY            15    WHITE
          

                   砭.   ᨬ᪨    । 
                   graphics.h

                   ਬ, ᫨   ⠭  梥  䮭  
                   ᨭ,   맢

                         setbkcolor(BLUE);
                         /*  */
                         setbkcolor(1);

                    ⥬    CGA  EGA setbkcolor  梥
                   䮭  ࢮ  .

                   砭. ᫨    ᯮ  VGA    EGA  
                     梥        setpalette 
                   setallpalette,   ।।  ᨬ᪨
                   ⠭        ॡ㥬 梥.  
                   ந室 ⮬,    ࠬ    setbkcolor
                   ⮡ࠦ    ⥪饩 ,   
                   㪠 梥 (᫨ ࠬ  ࠢ 0,  .. 
                   ᥣ ⠭ 梥 䮭  ).

頥       .
祭

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

 ⠪     getbcolor, setallpalette, setcolor, setpalette.

ਬ:

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

int main(void)
{
/*  ࠩ  ०, ন騥 ᪮쪮 梥⮢ 䮭 */
int graphdriver = EGA, gmode = EGAHI, errorcode;
int bkcolor,x,y,maxcolor;
char msg[80];

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

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
/* ᨬ ন  梥 */
maxcolor = getmaxcolor();
/* ⠭ 業஢ ⥪ */
settextjustify(CENTER_TEXT,CENTER_TEXT);
x = getmaxx() / 2;
y = getmaxy() / 2;
/* 横  ⨬ 梥⠬ */
for(bkcol=0;bkcol<=maxcolor();bkcol++)
{
   /*  ࠭ */
   cleardevice();
   setbkcolor(bkcol);
   /* 뢥 ᮮ饭 */
   if(bkkol == WHITE)
      setcolor(EGA_BLUE);
   sprintf(msg,"Background color: %d",bkcol);
   outtext(x,y,msg);
   getch();
}
/* ⪠ */
getch();
closegraph();
return 0;
}


setblock

㭪             ࠧ ࠭ 뤥 ᥣ
                   .

⠪          #include<dos.h>
                   int setblock(unsigned segx, unsigned newsize);

, ᮤঠ騩   dos.h
⨯

ᠭ           setblock  ࠧ ᥣ .  segx  -
                     ᥣ,      祭  맮
                   㭪樨 allocmem.  newsize -   室
                   ࠧ ᥣ  ࠣ.

頥       setblock 頥 -1  ᯥ譮 襭.
祭             訡  頥 ࠧ
                    ࠣ ᠬ 讣   ⠭
                   ᮮ⢥饥 祭  ६ _doserrno.

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

 ⠪     allocmem, freemem.

ਬ:

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

int main(void)
{
   unsigned int size,segp;
   int stat;
   size = 64; /* 뤥 1024  (16 * 64) */
   stat = allocmem(size,&segp);
   if(stat == -1)
      printf(" 뤥  ᥣ %X\n",segp);
   else
   {
      printf("訡. ᨬ ࠧ : %d\n",stat);
      exit(1);
   }
   stat = setblock(segp,size*2);
   if(stat == -1)
      printf("७   ᥣ %X\n",segp);
   else
      printf("訡. ᨬ ࠧ : %d\n",stat);
   freemem(segp);
   return 0;
}


setbuf

㭪            砥   ⮪ stream.

⠪          #include <stdio.h>
                   void setbuf(FILE *stream, char *buf);

, ᮤঠ騩   stdio.h
⨯

ᠭ           㭪 setbuf     뤥        buf    
                   ᯮ짮    /뢮  -  
                   ⮬᪨   뤥塞   .      㤥
                   ᯮ짮 ⮫쪮 ᫥ ⮣,   ⮪
                   stream 㤥 .

                    ᯮ짮 㭪樨  setbuf,  ᫨  ࠬ
                   buf = NULL,  /뢮 ந  ; 
                   ⨢ 砥  ᯮ.

                        BUFSIZE  ⮢  (
                   ⠭ ।  䠩 stdio.h).

                   ⠭       뢮  stdin    stdout  
                   ᯮ   ஢,    ᫨            뫨
                   ७祭;    ⨢ 砥,    뢮
                   ந  ਧ樥.

                   unbuffered (ਧ /뢮) 砥,
                      ᨬ,  뢠    ⮪,  㯠
                   ।⢥  䠩     ன⢮;    
                   ६    buffered  (ਧ  /뢮)
                   砥,    ᨬ        ⥬
                   뢠,  .

                   㭪 setbuf    ਢ    ।
                   १⠬,  ᫨    뢠      ⮪
                   stream,  祬  ᫥   樥
                     맮 㭪樨 fseek.  맮 㭪樨
                   setbuf ᫥ ⮣,   ⮪ stream ࠡ⠭ 
                   ஢, ࠧ襭,   맮 訡.

                    ࠭ 稭 訡 
                   ࠧ饭    ,        ⢥   automati
                   (쭮) ६    ⥬  ⪠  
                   䠩  室  㭪樨,   ன  
                   .

頥       .
祭

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

 ⠪     fflush, fopen, fseek, setvbuf.

ਬ:

#include<stdio.h>

/* BUFSIZE ।  stdio.h */
char buf[BUFSIZE];

int main(void)
{
   int i;
   /*    ⠭⭮ ⮪ */
   setbuf(stdout,buf);
   /*    ᨬ */
   puts("  ਧ 뢮.\n");
   puts(" 뢮 ⢫  buf\n");
   puts("  祣  㢨,    \n");
   puts("    .\n");
   /*  ⮪ */
   fflush(stdout);
   return 0;
}


setcbrk

㭪            ⠭ control-break.

⠪          #include<dos.h>
                   int setcbrk(int value);

, ᮤঠ騩   dos.h
⨯

ᠭ           setcbrk ᯮ 㭪 DOS 033  ⠭
                   䫠 Ctrl_Break.

                   value = 0 몫砥 ॠ  Ctrl_Break (-
                             祭 ⮫쪮  ६ 権 /-
                               ᮫, ਭ  㭨-
                             樮 .)

                   value = 1 砥 ॠ  Ctrl_Break. (
                              ⥬ 맮).

頥       setcbrk 頥 value, .. ।
祭           祭.

७ᨬ      setcbrk 㭨쭠  DOS.

 ⠪     getcbrk.

ਬ:

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

int main(void)
{
   int break_flag;
   printf(" 몫祭  0\n");
   printf(" 祭  1\n");
   break_flag = getch()-'0';  /* ਬ. .  ਣ  . */
   setcbrk(break_flag);
   if(getcbrk())
      printf(" Ctrl-Break 祭\n");
   else
      printf(" Ctrl-Break 몫祭\n");
   return 0;
}


setcolor

㭪            ⠭ ⥪騩 梥 ᮢ, ᯮ
                   .

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

, ᮤঠ騩   graphics.h
⨯

ᠭ           setcolor   ⥪騩  梥  뢮,  
                      0  getmaxcolor.

                   訩 梥  뢮  -      祭   ஥
                   ᢠ  ᥫ  ᮢ   ..
                   騥 ⠡ ᮤঠ 梥,  ᯮ㥬  
                   CGA  EGA ᮮ⢥⢥.

    
        ⠭ ᢮  梥(祭 ᥫ
              1               2               3
    
         0     CGA_LIGHTGREEN   CGA_LIGHTRED       CGA_YELLOW
         1     CGA_LIGHTCYAN    CGA_LIGHTMAGENTA   CGA_WHITE
         2     CGA_GREEN        CGA_RED            CGA_BROWN
         3     CGA_CYAN         CGA_MAGENTA        CGA_LIGHTGRA
    

                           
                           ᫮        ᪮
                           祭         
                           
                               0           BLACK
                               1           BLUE
                               2           GREEN
                               3           CYAN
                               4           RED
                               5           MAGENTA
                               6           BROWN
                               7           LIGHTGRAY
                               8           DARKGRAY
                               9           LIGHTBLUE
                              10           LIGHTGREEN
                              11           LIGHTCYAN
                              12           LIGHTRED
                              13           LIGHTMAGENTA
                              14           YELLOW
                              15           WHITE
                           

                    롨ࠥ  梥 뢮,  뫠  ᠬ 
                   梥,   ᮮ⢥饥 ᨬ᪮    
                   setcolor. ਬ,  ० CGAC0  ⮨
                       梥⮢:   梥   䮭,   મ,
                   મ   .   ⮬ ०  맮
                   setcolor(3)   setcolor(CGA_YELLOW)  롨ࠥ
                    梥 㭪.

頥       .
祭

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

 ⠪     getcolor, getmaxcolor, graphresult,
                   setallpalette, setbkcolor, setpalette.

ਬ:

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

int main(void)
{
/*  ࠩ  ०, ন騥 ᪮쪮 梥⮢ */
int graphdriver = EGA, gmode = EGAHI, errorcode;
int color,x,y,maxcolor;
char msg[80];

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

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
/* ᨬ ন  梥 */
maxcolor = getmaxcolor();
/* ⠭ 業஢ ⥪ */
settextjustify(CENTER_TEXT,CENTER_TEXT);
x = getmaxx() / 2;
y = getmaxy() / 2;
/* 横  ⨬ 梥⠬ */
for(color=0;color<=maxcolor();color++)
{
   /*  ࠭ */
   cleardevice();
   setcolor(color);
   /* 뢥 ᮮ饭 */
   sprintf(msg,"Color: %d",color);
   outtext(x,y,msg);
   getch();
}
/* ⪠ */
getch();
closegraph();
return 0;
}


_setcursortype

㭪            ।  .

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

, ᮤঠ騩   conio.h
⨯

ᠭ           ⠭    ,      ᨬ  
                   祭:

                   _NOCURSOR       - 몫砥 
                   _SOLIDCURSOR    -    
                   _NORMALCURSOR   -     ન-
                                     

頥       .
祭

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

ਬ:

#include<conio.h>

int main(void)
{
   /* 뢥   */
   cprintf("\r\nଠ :");
   getch();
   /* 몫  */
   setcursortype(_NOCURSOR);
   cprintf("\r\n :");
   getch();
   /*     */
   setcursortype(_SOLIDCURSOR);
   cprintf("\r\n   :");
   getch();
   /*    */
   cprintf("\r\nଠ :");
   getch();
   return 0;
}


setdate

㭪            ⠭  DOS.

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

, ᮤঠ騩   dos.h
⨯

ᠭ           setdate ⠭ ⥬  (, ,
                   )   data,   㪠뢠 datep.

                    date । ᫥騬 ࠧ:

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

頥       .
祭

७ᨬ      setdate 㭨쭠  DOS.

 ⠪     getdate, gettime, settime.

ਬ:

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

int main(void)
{
   struct date reset;
   reset.da_year = 2001;
   reset.da_mon  = 1;
   reset.da_day  = 1;
   setdate(&reset);
   system("date");
   return 0;
}


setdisk

㭪            ⠭ ᯥ䨪 ⥪饣 ᪮.

⠪          #include<dir.h>
                   int setdisk(int drive);

, ᮤঠ騩   dir.h
⨯

ᠭ           setdisk ⠭      ⥪騬       ᪮,
                   ।塞 ࠬ஬ drive (0 - A, 1 - B, 2 - C
                    . .). ⭮ 맮 㭪樨 DOS 00.

頥       setdisk 頥 饥 ᫮ 㯭 ᪮-
祭           .

७ᨬ      setdisk 㭨쭠  DOS.

 ⠪     getdisk.

ਬ:

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

int main(void)
{
   int maxdrives;
   maxdrives = setdisk(2);
   printf("㯭 %d ᪨ ன\n",maxdrives);
   return 0;
}


setdta

㭪            ⠭  DTA. ( 裡  ᪮).

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

, ᮤঠ騩   dos.h
⨯

ᠭ           setdta   ⥪騩      裡  
                   ᪮ (DTA)  祭 ࠬ dta.

頥       .
祭

७ᨬ      setdta 㭨쭠  DOS.

 ⠪     getdta.

ਬ:

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

int main(void)
{
   char far *save_dta;
   char line[80];
   char buffer[256] = "SETDTA test!";
   struct fcb blk;
   int result;
   /*   䠩 */
   printf("   䠩 ( , ਬ\
           a:file.dat)\n");
   gets(line);
   /*   䠩  FCB */
   if(!parsfnm(line,&blk,1))
   printf("ன⢮ #%d 䠩: %s\n\n",blk.fcb_drive, blk.fcb_name);
   /* ᮧ 䠩,  ᯮ짮 㭪権 DOS, ࠡ  FCB */
   if(bdosptr(0x16,&blk,0)==-1)
   {
      printf("訡  ᮧ 䠩\n");
      exit(1);
   }
   /* ࠭  DTA, ᮧ  */
   save_dta = getdta();
   setdta(buffer);
   /* 뢮  䠩 */
   blk.fcb_recsize = 256;
   blk.fcb_random = 0L;
   result = randbwd(&blk,1);
   /* ஢ १ 樨 */
   printf("result = %d",result);
   if(!result)
      printf(" 祭 ᯥ譮\n");
   else
   {
     perror("訡 ᪠\n");
     exit(1);
   }
   /*  䠩 */
   if(bdosptr(0x10,&blk,0)==-1)
   {
      printf("訡  ⨨ 䠩\n");
      exit(1);
   }
   /* ⠭ DTA */
   setdta(save_dta);
   return 0;
}


setfillpattern

㭪            롨ࠥ । 짮⥫ 蠡
                   ᪨.

⠪          #include <graphics.h>
                   void far setfillpattern(char far *upattern,
                                            int color);

, ᮤঠ騩   graphics.h
⨯

ᠭ           setfillpattern 筠 㭪樨 setfillstyle, 
                   ᪫祭   ⮣,      ᯮ    
                   ⠭ । 짮⥫ 蠡 8  x
                   8  ஥ 蠡.

                   upattern - 㪠⥫   ᫥⥫쭮    8
                   ,     ᮮ⢥ 8- ᥫ
                   蠡.   蠡  ⠭
                    1, 뢠 ⮡ࠦ ᮮ⢥饣 ᥫ
                    ࠭.

頥       .
祭
                   
७ᨬ      㭪 㭨쭠  Borland C++.  ࠡ⠥
                   ⮫쪮   IBM PC  ᮢ⨬  -
                   , ᭠饭 ᯫ묨 ࠬ, ন-
                   騬 ᪨ ०.
                   
 ⠪     getfillpattern, getfillsettings,
                   graphresult, sector, setfillstyle.

ਬ:

#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,0x24,0x24,0x07,0x00);

/* 樠 䨪   ६ */
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();
closegraph();
return 0;
}


setfillstyle

㭪            ⠭ 蠡  梥 .

⠪          #include <graphics.h>
                   void far setfillstyle(int pattern,int color);

, ᮤঠ騩   graphics.h
⨯

ᠭ           setfillstyle ⠭ ⥪騥 梥    蠡
                   .   ⠭ 蠡,  ।
                   짮⥫  ⠭ pattern ࠢ  12
                   (USER_FILL)    setfillfile,     ᯮ
                   㭪 setfillpattern.

                   塞 ⨯  fill_patterns,  ।  
                   graphics.h,       ஥   蠡
                       蠡,  ।塞
                   짮⥫.


               祭            ᠭ

  EMPTY_FILL          0         梥⮬ 䮭
  SOLD_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.

 ⠪     bar, bar3d, fillpoly, floodfill,
                   getfillsettings, graphresult, pieslice,
                   sector, setfillpattern.

ਬ:

#include <graphics.h>
#include <stdlib.h>
#include <string.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,style;
char stylestr[40];

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

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
midx = getmaxx()/2;
midy = getmaxy()/2;
for(style=EMPTY_FILL;style<USER_FILL;style++)
{
   /* ⠭ ⨯  */
   setfillstyle(style,getmaxcolor());
   /* ८ࠧ  ப */
   strcpy(stylestr,fname[style]);
   /*  ࠭   ⮣ 蠡 */
   bar (0,0,maxx,maxy);
   /* 뢥 ᮮ饭 */
   outtextxy(midx,midy,stylestr);
   /*    */
   getch();
   cleardevice();
}

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


setftime

㭪            ⠭   ६ ᮧ 䠩.

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

, ᮤঠ騩   io.h
⨯

ᠭ           setftime ⠭   ६         䠩,
                   易      ਯ஬  handle,   
                   ᮮ⢥⢨  ᮤন  ftime.

                    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 */
                   };

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

                     EINVFNC -   㭪樨.
                     EBADF   -   䠩.

७ᨬ      setftime 㭨쭠  DOS.

 ⠪     getftime.

ਬ:

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

int main(void)
{
   struct ftime filet;
   FILE *fp;
   if((fp=fopen("TEST.$$$","w")) == NULL)
   {
      perror("訡:");
      exit(1);
   }
   fprintf(fp,"஢...\n");
   filet.ft_tsec = 1;
   filet.ft_min = 1;
   filet.ft_hour = 1;
   filet.ft_day = 1;
   filet.ft_month = 1;
   filet.ft_year = 21;
   system("dir TEST.$$$");
   setftime(fileno(fp),&filet);
   system("dir TEST.$$$");
   fclose(fp);
   unlink("TEST.$$$");
   return 0;
}


setgraphbufsize

㭪             ࠧ ७ ᪮ .

⠪          #include <graphics.h>
                   unsigned far setgraphbufsize(unsigned bufsize);

, ᮤঠ騩   graphics.h
⨯

ᠭ            ᪨    㭪樨    (⠪     
                   floodfill)   ᯮ      ,  
                   뤥  맮 initgraph   ⬥  
                   맮  closegraph.    㬮砭  ࠧ  ⮣,
                   뤥塞   _graphgetmem,    ࠢ
                   4096 .

                       ᤥ            (
                   ᡥ० )   (᫨, ਬ, 
                   饭  floodfill 頥 訡 -7:  Out
                   of flood memory).

                   setgraphbufsize ᮮ頥  initgraph ᪮쪮 
                   뤥     ⮣   ஥   ᪮
                   ,   頥  _graphgetmem.

                   砭.     뢠 setgraphbufsize 
                   맮 initgraph. ᫨  initgraph 맢,  
                   饭    setgraphbufsize  ஢
                    맮 closegraph.

頥       setgraphbufsize 頥 ।騩 ࠧ
祭           ஥ .

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

 ⠪     closegraph, _graphfreemem, _graphgetmem,
                   initgraph, sector.

ਬ:

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

#define BUFSIZE 1000 /* ࠧ ७  */

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

oldsize = setgraphbufsize(BUFSIZE);
/* 樠 䨪   ६ */
initgraph(&graphdriver,&gmode,"");

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
x = getmaxx()/2;
y = getmaxy()/2;
/* 뢥 ଠ */
sprintf(msg," ᪮ : %d",BUFSIZE);
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(x,y,msg);
sprintf(msg," ࠧ ᪮ : %d",oldsize);
outtextxy(x,y+textheigth("W"),msg);
/* ⪠ */
getch();
closegraph();
return 0;
}


setgraphmode

㭪            ॢ ⥬  ᪨ ०, 頥
                   ࠭.

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

, ᮤঠ騩   graphics.h
⨯

ᠭ           setgraphmode 롨ࠥ ᪨  ०  ⫨
                    ⠭  㬮砭 㭪樥 initgraph.
                   mode         ०,   ⨬   
                   ᯮ㥬 ࠩ. setgraphmode 頥 ࠭
                     ⠭     ᪨   稭   
                   祭  㬮砭 (CP,  ,  梥,  
                   ..).

                      ᯮ짮  setgraphmode  ᮢ⭮ 
                   restorecrtmode  ४祭   ᪨
                    ⥪⮢ ०.

頥       ᫨   setgraphmode 騩
祭            ᯮ㥬 ࠩ ०,  graphresult
                   ୥ 祭 -10 (grInvalidMode).

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

 ⠪     getgraphmode, getmoderange, graphresult,
                   initgraph, restorecrtmode.

ਬ:

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

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

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

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
x = getmaxx()/2;
y = getmaxy()/2;
/* 뢥 ᮮ饭 */
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(x,y,"Press any key to exit graphics...");
getch();
/* ॢ ⥬  ⥪⮢ ० */
restorecrtmode();
printf("  ⥪⮢ ०\n");
printf("   ᪨ ०  .\n");
getch();
/*   ᪨ ० */
setgraphmode(getgraphmode());
/* 뢥 ᮮ饭 */
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(x,y,"We're back in graphics mode...");
outtextxy(x,y+textheight("W"),"Press any key to halt...");

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


setjmp

㭪            ⠭  室.

⠪          #include <setjmp.h>
                   int setjmp(jmp_buf jmpb);

, ᮤঠ騩   setjmp.h
⨯

ᠭ           setjmp 墠뢠   ﭨ      jmpb  
                   頥 0.

                   ᫥騩 맮      longjmp     ⠭
                   ﭨ   jmpb  頥 ⠪  
                    setjmp  祭 val.

                   Cﭨ  ।⠢ ᮡ ᫥饥:

                   -  ᥣ ॣ (CX,DS,ES,SS);
                   - ६-ॣ (SI,DI);
                   - 㪠⥫ ⥪ (SP);
                   - 㪠⥫  (BP);
                   - 䫠.

                   ﭨ    筮 ,  ⠪
                     㭪樨   setjmp      longjmp      
                   ᯮ짮      㬥     ࣠樨
                   ᮯணࠬ.

                   । ᯮ짮  㭪樨  longjmp  室
                   맢   㭪   setjmp.  ணࠬ  뢠
                   setjmp  ⠭  jmpb    ⠢
                   ⨢          ࠢ 
                   맮 longjmp.  ᫨  ,    १
                   ।᪠㥬.

                    ணࠬ      ࠡ
                      訡       ᪫⥫묨    ﬨ,
                   ந室騬      ஢   ணࠬ
                   ਪ ணࠬ.

                   ਬ砭. 㭪樨  setjmp      longjmp   
                   ᯮ짮    ॠ樨 ૥ ணࠬ.
                   筮    setjmp        longjmp    ࠭    
                   ⠭ ,  室  ॠ樨
                   ᮯணࠬ,        ࠢ   ૥ﬨ
                   室     ᫥         ⥪,    祬
                   ࠧ㬥,   ⥪  .    ॠ樨
                   ᮯணࠬ    筮 ᯮ  ⥪,  
                      ⥪,    ⮬  
                   ૥  ᬮ ४⭮  ᫥.

                         ,  ࠡ騥    䮭
                   ०,   ᯮ ᢮  ⥪,    ᢮
                   ࠧ   饣   ⥪,        
                   㢥७,     ᯮ ૥,    
                     ᯮ짮  ૥  ᨨ  setjmp 
                   longjmp  ४祭   䮭 .

頥       setjmp 頥 0  砫쭮 맮.
祭           ᫨  맮   ᫥ longjmp, setjmp
                   頥 㫥 祭 (  ਬ).

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

 ⠪     longjmp, signal.

ਬ:

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

void subroutine(void);

imp_buf jumper;

int main()
{
   int value;
   value = setjmp(jumper);
   if (value != 0) {
     printf("longjmp  祭 %d\n", value);
     exit(value);
   }
   printf("맮 ணࠬ ... \n");
   subroutine();
   return 0;
}
void subroutine(void)
{
   longjmp(jumper,l);
}


setlinestyle

㭪            ⠭ ⮫騭  ⨯ .

⠪          #include <graphics.h>
                   void far setlinestyle(int linestyle,
                              unsigned upattern, int thickness);

, ᮤঠ騩   graphics.h
⨯

ᠭ           ⠭ ⨯         ,   㥬
                   㭪ﬨ line, lineto, rectangle, drawpoly  ..

                    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    ন,    
                   .

                   砭. ࠬ  linestyle    ࠡ⠥   
                   ஥  ,  㣮,  ᮢ  ᥪ஢.  
                   ⮬ 砥 ᯮ ६ thickness.

頥       ᫨  setlinestyle । ࠢ-
祭            , graphresult  -11,  ⥪騩 ⨯
                    ⠭  .

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

 ⠪     arc, bar3d, circle, drawpoly, ellipse,
                   getlinesettings, graphresult, line, linerel
                   lineto, pieslice, rectangle.

ਬ:

#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;
int midx,midy,style,userpat;
char stylestr[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;
/* 짮⥫᪨ 蠡: 1 (:0000000000000001) */
userpat = 1;
for(style = SOLID_STYLE; style <= USERBIT_STYLE; style++)
{
   /* ⠭ ⨯  */
   setlinestyle(style,userpat,1)
   /* ॡࠧ  ப */
   strcpy(stylestr,lname[style]);
   /* ᮢ  */
   line(0,0,midx-10,midy);
   /* ᮢ אַ㣮쭨 */
   rectangle(0,0,getmaxx(),getmaxy());
   /* 뢥 ᮮ饭 */
   outtextxy(midx,midy,stylestr);
   /*    */
   getch();
   cleardevice();
}
/* ⪠ */
closegraph();
return 0;
}


setlocale

㭪            롨ࠥ locale.

⠪          #include<locale.h>
                   char *setlocale(int category,char *locale);

, ᮤঠ騩   locale.h
⨯

ᠭ           Borland C++   饥 ६ ন ⮫쪮
                   "" locale,  ⮬ 맮 ⮩ 㭪樨    㤥
                      ᫠.

                   㬥 category      ਭ    ᫥騥
                   祭:

                   LC_ALL
                   LC_COLLATE
                   LC_CTYPE
                   LC_MONETARY
                   LC_NUMERIC
                   LC_TIME

頥       ᫨ 롮 襫 㤠筮,  頥 ப
祭           ᮤঠ ஥ 祭.  訡 -
                   頥 0.

७ᨬ      setlocale ন ⠭⮬ ANSI C.

 ⠪     localeconv.

ਬ:

#include<locale.h>
#include<stdio.h>

int main(void)
{
   char *old_locale;
   /*  Borland C++ ন ⮫쪮 "C" */
   old_locale = setlocale(LC_ALL,"C");
   printf("Old locale was %s\n",old_locale);
   return 0;
}


setmem

㭪            ᢠ 祭 ᥬ ⠬ ன 
                   .

⠪          #include<mem.h>
                   void setmem(void *dest, unsigned len, char value);

, ᮤঠ騩   mem.h
⨯

ᠭ           setmem ᢠ  ᥬ  ⠬      
                   ᮬ dest   len 祭 value.

頥       .
祭

७ᨬ      setmem 㭨쭠  ய஢ ᥬ⢠
                   8086.

 ⠪     memset, strset.

ਬ:

#include<stdio.h>
#include<alloc.h>
#include<mem.h>

int main(void)
{
   char *dest;
   dest = calloc(21,sizeof(char));
   setmem(dest,20,'c');
   printf("%s\n",dest);
   return 0;
}


setmode

㭪            ⠭ ०  䠩.

⠪          #include<fcntl.h>
                   int setmode(int handle, unsigned amode);

, ᮤঠ騩   io.h
⨯

ᠭ           㭪 setmode ⠭ ०  䠩
                   ( ,   ⥪⮢), ᮮ⢥饣
                   ࠬ  handle.  㬥  amode  ਭ 
                   ⮬  祭    O_BINARY,    O_TEXT,  
                      .   (  ᨬ᪨  ⠭
                   ।  䠩 fcntl.h)

頥        ᯥ譮 襭 㭪 setmode
祭           祭 0;  砥 訡 - 祭 -1, ஬
                   ⮣, 쭠   ६    errno    砥
                   祭:

                      EINVAL -  㬥.

७ᨬ      㭪 setmode ন  ⥬ UNIX.

 ⠪     _creat, creat, _open, open.

ਬ:

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

int main(void)
{
   int result;
   result = setmode(fileno(stdprn),O_TEXT);
   if(result == -1)
      printf("  ⨬\n");
   else
      printf(" ⠭.\n");
   return 0;
}


setpalette

㭪              梥  .

⠪          #include <graphics.h>
                   void far setpalette(int colornum, int color);

, ᮤঠ騩   graphics.h
⨯

ᠭ           setpalette ⠭  colornum  color.
                   ਬ,  setpalette(0,5)      梥
                   ⥪饩  (梥 䮭)  梥,  騩  
                   5. ᫨ size -  ⢮ ⮢   ⥪饩
                   ,    colornum       0 
                   (size -1).

                     筮 ( 楫)  梥 
                   EGA/VGA    setpalette.  CGA  
                               
                   (colornum ࠢ 0, 梥 䮭).

                    ᨢ     colors,     ᯮ㥬    
                   setpalette,         ।⠢    
                   ᨬ᪨ ⠭, ।  graphics.h:
                   
          
                     㯭 梥⮢
          
                 CGA                         EGA/VGA
                                              .
          
          BLACK                0    EGA_BLACK              0
          BLUE                 1    EGA_BLUE               1
          GREEN                2    EGA_GREEN              2
          CYAN                 3    EGA_CYAN               3
          RED                  4    EGA_RED                4
          MAGENTA              5    EGA_MAGENTA            5
          BROWN                6    EGA_LIGHTGRAY          7
          LIGHTGRAY            7    EGA_BROWN             20
          DARKGRAY             8    EGA_DARKGRAY          56
          LIGHTBLUE            9    EGA_LIGHTBLUE         57
          LIGHTGREEN          10    EGA_LIGHTGREEN        58
          LIGHTCYAN           11    EGA_LIGHTCYAN         59
          LIGHTRED            12    EGA_LIGHTRED          60
          LIGHTMAGENTA        13    EGA_LIGHTMAGENTA      61
          YELLOW              14    EGA_YELLOW            62
          WHITE               15    EGA_WHITE             63
          

                   ⨬,  梥   ⥪ ᪮
                   ࠩ  ᪮ ०.

                   , ந    ,   ࠧ   
                   ࠦ     ࠭.      梥  
                   ,    ࠭,  襭    梥,
                   ⠭ 襭   梥.

                   砭. setpalette      ᯮ짮 
                   ࠩ஬ IBM-8514.

頥       ᫨  setpalette । 訡筮
祭           祭, graphresult  -11(grError) 
                   ⥪  ⠭  .

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

 ⠪     getpalette, graphresult, setbkcolor, setcolor,
                   setrrgbpalette.

ਬ:

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

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
int color,maxcolor,ht;
int y=10;
char msg[80];

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

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
maxcolor = getmaxcolor();
ht = 2*textheight("W");
/* 뢥 梥  㬮砭 */
for(color=0;color<maxcolor; color++);
{
   setcolor(color);
   sprintf(msg,"Color %d",color);
   outtextxy(1,y,msg);
   y += ht;
}
/*    */
getch();
/* ᢮ 梥⠬  , 祭 ୮ */
for(color=0;color<maxcolor; color++);
{
   setpalette(color,BLACK);
   getch();
}

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


setrgbpalette

㭪             짮⥫ । 梥 
                   IBM 8514.

⠪          #include <graphics.h>
                   void far setgbpalette(int colornum,int red,
                                          int green, int blue);

, ᮤঠ騩   graphics.h
⨯

ᠭ           setgbpalette   ᯮ짮     ࠩࠬ
                   IBM8514  VGA.

                   colornum ।      ,   
                         㦥,    red,  green    blue
                   । 梥⮢ ⠢騥  .

                    ᯫ IBM8514 ( VGA  梥⭮ ०  256)
                   colornum    ࢠ  0  255.  
                   ⠫  ०  VGA  colornum      
                   ࢠ  0  15.  ᯮ ⮫쪮 訥
                    red,  green    blue,          6
                      㦠  .

                   砭.      ᮢ⨬          㣨
                   ᪨   ࠬ   IBM,    ࠩ    BGI
                   ⠭   16 ⮢  IBM8514
                    梥 EGA/VGA,  ᯮ㥬   㬮砭.  
                   祭    ᯮ짮   ,  
                       setrgbpalette.

頥       .
祭

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

 ⠪     setpalette.

ਬ:

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

int main(void)
{
/* 롮 ࠩ  ०, ন 㭪 setrgbpalette */
int graphdriver = VGA, gmode = VGAHI, errorcode;
/* 㪠⥫   ᠭ  */
struct palettetype pal;
int i,ht,y,xmax;

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

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
/*    */
getpalette(&pal);
for(i=0;i<pal.size;i++);
{
   setrgbpalette(pal.colors[i],i*4,i*4,i*4);
/* 뢥 ᮮ饭 */
ht = getmaxy()/16;
xmax = getmaxx();
y=0;
for(i=0;i<pal.size;i++);
{
   setfillstyle(SOLID_FILL,i);
   bar(0,y,xmax,y+ht);
   y += ht;
}
/* ⪠ */
getch();
closegraph();
return 0;
}


settextjustify

㭪            ⠭ ࠢ ⥪  ᪨
                   㭪権.

⠪          #include <graphics.h>
                   void far settextjustify(int horiz,int vert);

, ᮤঠ騩   graphics.h
⨯

ᠭ           뢮 ⥪,  ᫥ 饭  settextjustify
                   㤥   ࠢ   ਧ⠫쭮    ⨪쭮
                   ⭮⥫쭮 ⥪饩 樨  ().    㬮砭
                   ⠭ ࠢ ⥪ LEFT_TEXT (
                   ਧ⠫쭮)  TOP_TEXT  (  ⨪쭮).
                   ᫥   graphics.h text_just ।⠢
                   ᮡ      ⠭  horiz    vert   
                   ।  settextjustify.

                   
                          .       ᠭ
                   
                    LEFT_TEXT        0      horiz
                    CENTER_TEXT      1      horiz  vert
                    RIGHT_TEXT       2      horiz
                    BOTTOM_TEXT      0      vert
                    TOP_TEXT         2      vert
                   

                   ᫨ horiz  ࠢ  LEFT_TEXT    direction   ࠢ
                   HORIZ_DIR,    x CP த  
                   textwidth(string) ᫥ 맮 outtext(string).

                   settextjustify ࠡ⠥     ⥪⠬   뢮묨
                   㭪樥  outtext       ᯮ짮 
                   ⥪⮢  ०         ⮪ਥ஢묨
                   㭪ﬨ.

頥       ᫨  settextjustify । ࠢ
祭           ,  graphresult  -11,  ⥪饥
                   ࠢ ⥪ ⠭  .

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

 ⠪     gettextsettings, graphresult, outtext,
                   settextstyle.

ਬ:

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

/* ⨯ 㭪樨 */
void xat(int x,int y);

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

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

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
int midx,midy,hj,vj;
char msg[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;
/* 横  ࠢ */
for(hj=LEFT_TEXT;hj<RIGHT_TEXT;hj++)
   for(vj=LEFT_TEXT;vj<RIGHT_TEXT;vj++)
   {
      cleardevice();
      /* ⠭ ࠢ ⥪ */
      settextjustify(hj,vj);
      /* ᮧ ப ᮮ饭 */
      sprintf(msg,"%s %s",hjust[hi],vjust[vj]);
      /* ᮧ ⨪  ࠭ */
      xat(midx,midy);
      /* 뢥 ᮮ饭 */
      outtextxy(midx,midy,msg);
      getch();
   }
/* ⪠ */
getch();
closegraph();
return 0;
}
/* 㭪  ⨪  न⠬ x  y */
void xat(int x, int y)
{
   line(x-4,y,x+4,y);
   line(x,y-4,x,y+4);
}


settextstyle

㭪            ⠭ ⥪騥 ࠪ⨪ ⥪ 
                   ᪮ 뢮.

⠪          #include <graphics.h>
                   void far settextstyle(int font,int direction,
                                          int charsize);

, ᮤঠ騩   graphics.h
⨯

ᠭ           settextstyle ⠭            ⥪,
                   ࠢ  ⮡ࠦ ⥪  ࠧ ᨬ.
                   맮 settextstyle       ⥪⮢,
                   뢮   outtext  outtextxy.

                   ࠬ font, direction  charsize, ।
                    settextstyle, ᠭ ᫥騬 ࠧ:

                   font: ⨬:      楩 88  
                   ᪮쪮 "⨫"  ⮢.    㬮砭
                   ᯮ         楩   88   ⮢.
                   ᫥    font_names,    ।     
                   graphics.h, ।  ࠧ ⮢(
                   ᬮ ⠡):

                   
                                .    ᠭ
                   
                   DEFAULT_FONT       0      88 
                   TRIPLEX_FONT       1     ஥ 
                   SMALL_FONT         2      
                   SANSSERIF_FONT     3      sans-serif
                   GOTHIC_FONT        4     ᪨ 
                   

                   ⮢ ,  ᯮ㥬  㬮砭, ஥
                         ⥬.   ⨫  
                   ࠭  ᪮  䠩  *.CHR      
                     ࠭    .  ⮬    롮
                   ,  ⫨筮    㦥     ⥬,
                   室  㧨 ᮮ⢥騩 *.CHR-䠩 
                   ᪠.
                   
                        㧮     ᯮ짮
                   ᪮쪨  ⮢     ⮢
                   䠩      ணࠬ     .   
                   ⢫ ⥬ ८ࠧ   ꥪ
                   䠩   ⨫ BGIOBJ    ॣ樨  
                   १  register-  bgifont,    ᠭ    䠩
                   UTIL.DOC, ⠢塞   Borland C++.

                   direction: ন      ࠢ    -
                   ਧ⠫ ⥪     (᫥     ࠢ)     
                   ⨪ ⥪ (  90 ࠤᮢ ⨢
                   ᮢ  ५).    㬮砭 ࠢ ࠢ
                   HORIZ_DIR.

                   
                                .    ᠭ
                   
                     HORIZ_DIR        0      ᫥ ࠢ
                     VERT_DIR         1      ᭨ 
                   

                   charsize: ࠧ      ᨬ     
                   㢥祭  䠪஬  charsize.  祭   charsize
                   ࠢ  0  ᯮ  ⮫쪮   ⨫묨
                   ⠬,    㫥  祭  charsize  
                   ᯮ짮   ᭮ ⮢ ⮬.

                   1) ᫨  charsize  ࠢ  1,  outtext   outtextxy
                       ⮡ࠦ ⮢   88    
                      אַ㣮쭨 88 ᥫ  ࠭.

                   2) ᫨  charsize  ࠢ 2,   㭪 ⮡ࠧ
                       88   אַ㣮쭨 1616  ᥫ
                        ࠭,    ..(    ࠭祭  10 ࠧ
                        ଠ쭮 ࠧ).

                   3)  charsize ࠢ 0,  㭪樨 뢮 outtext
                        outtextxy 㢥稢  ⥪ ᯮ
                         䠪   㢥祭    ᨬ(4)    
                      㬮砭,     ࠧ    ।
                      짮⥫, ᯮ setusercharsize.

                   ᯮ ⠪  textheight     textwidth   
                   । ࠧ .

頥       .
祭

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

 ⠪     gettextsettings, graphresult,
                   installuserfont, settextjustify, 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"
                };

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
int style,midx,midy;
int size=1;

/* 樠 䨪   ६ */
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);
/* 横  ⠬ */
for(style=DEFAULT_FONT;style<GOTHIC_FONT;style++)
{
   cleardevice();
   if(style==TRIPLEX_FONT)
      size = 4;
   /* ⠭ ⨯  */
      settextstyle(style,HORIZ_DIR,size);
      /* 뢥 ᮮ饭 */
      outtextxy(midx,midy,fname[style]);
      getch();
   }
/* ⪠ */
getch();
closegraph();
return 0;
}


settime

㭪            ⠭ ⥬ ६.

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

, ᮤঠ騩   dos.h
⨯

ᠭ           settime ⠭     ⥬     ६    
                   ᮮ⢥⢨    ᮤন    time,   
                    㪠뢠 ࠬ timep.

                    time । ᫥騬 ࠧ:

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

頥       .
祭

७ᨬ      settime 㭨쭠  DOS.

 ⠪     ctime, getdate, gettime, setdate, time.

ਬ:

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

int main(void)
{
   struct time t;
   gettime(&t);
   printf(": %d\n",t.ti_min);
   printf(": %d\n",t.ti_hour);
   printf(": %d\n",t.ti_hund);
   printf("ᥪ㭤: %d\n",t.ti_sec);
   /* 㢥 稪  */
   t.ti_min++;
   settime(&t);
   return 0;
}


setusercharsize

㭪             짮⥫   ਭ  
                   ᨬ   ⮢.

⠪          #include <graphics.h>
                   void far setusercharsize(int multx,int divx,
                                            int multy,int divy);

, ᮤঠ騩   graphics.h
⨯

ᠭ           setusercharsize     ࠢ ࠧ஬
                   ⥪         ⮢,    ᯮ㥬
                   ᪨   㭪ﬨ.  祭  ⠭
                   㭪樥 setusercharsize   ⢨⥫묨
                   ⮫쪮   ᫨   charsize,  ⠭  ࠭  
                    settextstyle, ࠢ 0.

                      setusercharsize  । 䠪,
                     ⠡ ਭ  .  ਭ
                      ,   ⠭    㬮砭,  
                       ࠧ      multx:divx  
                   multy:divy    ᮮ⢥⢥.    ਬ,    ᫨
                   室 ᤥ ⥪   ࠧ     50%
                   , ⠭:

                      multx = 2; divx = 1;
                      multy = 3; divy = 2;

頥       .
祭

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

 ⠪     gettextsettings, graphresult, settextsyle.

ਬ:

#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);  /* 襭   訡 */
}
/*  ⨯  */
settextstyle(TRIPLEX_FONT,HORIS_DIR,4)
/* ६ CP  砫  */
moveto(0,getmaxy()/2);
/* 뢥 ⥪ */
outtext("Norm ");
/* ᤥ   1/3 ଠ쭮  */
setusercharsize(1,3,1,1);
outtext("Short ");
/* ᤥ   3 ࠧ  ଠ쭮 ਭ */
setusercharsize(3,1,1,1);
outtext("Wide ");
/* ⪠ */
getch();
closegraph();
return 0;
}


setvbuf

㭪            砥   ⮪ stream.

⠪          #include <stdio.h>
                   void setvbuf(FILE *stream, char *buf, int type,
                                                       size_t size);

, ᮤঠ騩   stdio.h
⨯

ᠭ           㭪 setvbuf    뤥        buf    
                   ᯮ짮      /뢮 - 
                   ⮬᪨ 뤥塞 .    뢠
                   ⮫쪮  ᫥ ⮣,    ⮪ stream 㤥
                   .

                    맮  㭪樨  setvbuf,  ᫨ ࠬ buf =
                   NULL,    㤥  뤥  ।⢮  malloc;
                   ࠬ  size  㤥  । ꥬ 뤥
                   .  ࠬ size । ࠧ   
                      .

                   砭. ࠬ   size       ॢ
                   32767.

                   ⠭     뢮  stdin     stdout   
                   ᯮ    ஢,    ᫨           뫨
                   ७祭;   ⨢ 砥,     뢮
                   ந       ਧ樥.      unbuffered
                   (ਧ   /뢮)   砥,    
                   ᨬ,    뢠       ⮪,   㯠
                   ।⢥  䠩     ன⢮;    
                   ६    buffered  (ਧ  /뢮)
                   砥,    ᨬ        ⥬
                   뢠,  .

                   ࠬ type    ᫥ 祭:

                   _IOFBF   ᯮ      (fully
                          buffered).  ᫨     ,   ᫥
                              ⠥   .
                          । ⥬,    뢠  䠩,
                          뢮               
                          .

                   _IOLBF   ᯮ    筮   (line
                          buffered).       ,  ᫥
                            ⠥  .  
                            ,   뢮  㤥 襭,
                           ⮫쪮    䠩  㤥  ᠭ  ᨬ
                          室   ப.

                   _IONBF     ᯮ  ஢ (unbuffered).
                          ࠬ buf  size  .  
                                㤥  뢠  
                          ।⢥  䠩,   
                          뢮      㤥     뢠     
                          ।⢥  䠩.

                    ࠭ 稭 訡 
                   ࠧ饭    ,        ⢥   automati
                   (쭮) ६    ⥬  ⪠  
                   䠩  室  㭪樨,   ன  
                   .

頥       㭪 setvbuf  ᯥ譮 襭 頥
祭           0.    頥, ᫨ ࠬ type 
                   size     祭;      ᫨   
                   ࠧ饭  墠⠥ .

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

 ⠪     fflush, fopen, setbuf.

ਬ:

#include <stdio.h>

int main(void)
{
   FILE *input, *output;
   char bufr[512];
   input = fopen("file.in", "r");
   output = fopen("file.out", "w");
   /* 㪠      ᢮  */
   if (setvbuf(input, bufp,_IOLBF, 512) != 0)
       printf("訡,  ।   室 䠩\n");
   else
       printf(" ।\n");
   /*  ।  室 䠩  ਧ,  
       । ,  㤥 뤥,   맮
       㭪樨 malloc */
   if (setvbuf(output, NULL,_IOLBF, 132) != 0)
       printf("訡,  ।   室 䠩\n");
   else
       printf(" ।\n");
   /*  뢮 */
   /*  䠩 */
   fclose(input);
   fclose(output);
   return 0;
}


setvect

㭪            ⠭  뢠.

⠪          void setvect(int intr_num, void interrupt(*isr)());

, ᮤঠ騩   dos.h
⨯

ᠭ            ய  ᥬ⢠   8086   砥
                    ஢ 뢠,  ࠬ  0  255.
                     ⮢  祭        
                   ⢨⥫쭮    ।⠢    ᮡ   
                   ணࠬ ࠡ⪨ ᮮ⢥ 뢠.

                   setvect ⠭    ணࠬ  ࠡ⪨
                   뢠  ஬ intr_num,  ।  
                    ࠬ isr.  ணࠬ  ।
                   ⮫쪮    ⮬  砥,  ᫨      
                   ணࠬ ࠡ⪨ 뢠 (interrupt).

                   ਬ砭. ᫨        ᯮ   ⨯,
                     dos.h       뫠
                     ணࠬ ࠡ⪨ 뢠 setvect 
                     .

頥       .
祭

७ᨬ      setvect 㭨쭠  ய஢ ᥬ⢠
                   8086.

 ⠪     getvect.

ਬ:

/*  ਬ砭:
     ணࠬ ࠡ⪨ 뢠.   ஢
     ணࠬ  ⪫祭 㭪樥 ஢ન ९
    ⥪ (Test Steck Overflow - off).  */

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

#define INTR 0X1C  /* 뢠  ⠩ */

void interrupt (*oldfunc)(); /* 㪠⥫  뢠 */
int count = 0;

void interrupt handler()
{
   /* 㢥 稪 */
   count ++;
   /* 맢   */
   oldfunc();
}

int main(void)
{
   /* ࠭   */
   oldfunc = getvect(INTR);
   /* ⠭   */
   setvect(INTR,handler)
   /* 祣   */
   while(count<20)
      printf("稪 = %d\n",count);
   /* ⠭   */
   setvect(INTR,oldfunc);
   return 0;
}


