
parsfnm

㭪            뤥  䠩.

⠪          #include <dos.h>
                   char *parsfnm(const char * cmdline,
                     struct fcb *fcb, int opt);

, ᮤঠ騩   dos.h
⨯

ᠭ           㭪 parsfnm   뤥      ப  ᨬ
                   (筮  ப)      㪠⥫
                   cmdline  䠩.  䠩 頥   FCB
                     ன⢠,   䠩  ७  
                   䠩.  ⥫    FCB  㪠⥫
                   fcbptr.

                   ࠬ opt    ।⠢    ᮡ    祭,
                   ।      ॣ   AL,        맮
                   ᮮ⢥饩 㭪樨 DOS, 뤥騩  䠩.
                    "ࠢ筮 㪮⢮  ணࠬ  
                   DOS",  ஬    ஡ ᠭ
                   ⥬ 맮 0x29, 믮饣 襮ᠭ
                   ⢨.

頥        ᯥ譮 襭 㭪 parsfnm 頥
祭           㪠⥫  , ᫥騩  殬  䠩-
                   . ᫨       믮   㭪樨   ந諠
                   﫨 訡, 㭪 頥 祭 0.

७ᨬ      㭪 㭨쭠  DOS.

ਬ:

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

int main(void)
{
   char line[80];
   struct fcb blk;
   /*   䠩 */
   printf("  ன⢠  䠩 ( , ..\
            a:filename.ext)\n");
   gets(line);
   /*   䠩  FCB ( ࠢ 䠩) */
   if(parsfnm(line,&blk,1) == NULL)
      printf("訡  맮 parsfnm.\n");
   else
      printf("ன⢮: #%d : %11s\n",blk.fcb_drive,
              blk.fcb_name);
   return 0;
}


peek

㭪            頥 ᮤন ᫮   ᮬ
                   segment:offset.

⠪          #include<dos.h>
                   int peek(unsigned segment, unsigned offset);

, ᮤঠ騩   dos.h
⨯

ᠭ           㭪 peek  頥  ᮤন ᫮ ,
                     segment:offset.

                   ᫨ 㭪  뢠    祭  䠩
                   dos.h,   ࠪ,   ப, 
                       ஥  .  ᫨   
                   砥  䠩  dos.h  (    믮  
                    㭪樨 ४⨢ #undef),   㤥 
                   㭪,   ப.

頥       㭪 peek 頥 祭, ࠭饥 
祭            segment:offset.

७ᨬ      㭪 㭨쭠  ᥬ⢠ ய஢
                   8086.

 ⠪     harderr, peekb, poke.

ਬ:

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

int main(void)
{
   int value = 0;
   printf(" :\n");
   value = peek(0x0040,0x0017);
   if(value & 1)
      printf("Rigth Shift on\n");
   else
      printf("Rigth Shift off\n");
   if(value & 2)
      printf("Left Shift on\n");
   else
      printf("Left Shift off\n");
   if(value & 4)
      printf("Control key on\n");
   else
      printf("Control key off\n");
   if(value & 8)
      printf("Alt key on\n");
   else
      printf("Alt key off\n");
   if(value & 16)
      printf("Scroll lock on\n");
   else
      printf("Scroll lock off\n");
   if(value & 32)
      printf("Num lock on\n");
   else
      printf("Num lock off\n");
   if(value & 64)
      printf("Caps lock on\n");
   else
      printf("Caps lock off\n");
   return 0;
}


peekb

㭪            㭪 peekb    , ᠭ
                     segment:offset.

⠪          #include <dos.h>
                   char peekb( unsigned segment, unsigned offset);

, ᮤঠ騩   dos.h
⨯

ᠭ           㭪 peekb    , ᠭ
                     segment:offset

                   ᫨ 㭪  뢠    祭  䠩
                   dos.h,   ࠪ,   ப, 
                       ஥  .  ᫨   
                   砥  䠩  dos.h  (    믮  
                    㭪樨 ४⨢ #undef),   㤥 
                   㭪樨,   ப.

頥       㭪 peekb 頥 祭   ᮬ
祭           segment:offset.

७ᨬ      㭪 㭨쭠  ᥬ⢠ ய஢
                   8086.

 ⠪     harderr, peek, pokeb.

ਬ:

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

int main(void)
{
   int value = 0;
   printf(" :\n");
   value = peekb(0x0040,0x0017);
   if(value & 1)
      printf("Rigth Shift on\n");
   else
      printf("Rigth Shift off\n");
   if(value & 2)
      printf("Left Shift on\n");
   else
      printf("Left Shift off\n");
   if(value & 4)
      printf("Control key on\n");
   else
      printf("Control key off\n");
   if(value & 8)
      printf("Alt key on\n");
   else
      printf("Alt key off\n");
   if(value & 16)
      printf("Scroll lock on\n");
   else
      printf("Scroll lock off\n");
   if(value & 32)
      printf("Num lock on\n");
   else
      printf("Num lock off\n");
   if(value & 64)
      printf("Caps lock on\n");
   else
      printf("Caps lock off\n");
   return 0;
}


perror

㭪            ⠥ ⥬ ᮮ饭  訡.

⠪          #include<stdio.h>
                   void perror (const char *s);

, ᮤঠ騩   stdio.h
⨯

ᠭ           㭪 perror  뢮   ᮮ饭      訡,
                   ந襤襩  筮 㭪樨,  ⮪ stderr
                   (筮  ᮫).

                   砫 뢮  㬥  s,  ⥬  稥,
                   ⥬   ᮮ饭      訡,   ᮮ⢥饥
                   ⥪饬 祭 쭮 ६ errno,  
                    -  ᨬ  室      ப.   
                   ᮣ饭  ⢥ 㬥 㭪樨 ।
                    䠩.

                    ᯥ祭      襣      ஫      
                   ଠ஢  ᮮ饭,  ᨢ  ᮮ饭  
                   訡,   ᮤন      ᨢ   sys_errlist.
                   ⢥⢥,   ६   errno     
                   ᯮ짮  ⢥     ⮬  ᨢ,
                   ⮡   ४⭮   뤥   ப,  ᮤঠ
                   ᮮ饭   ஬.  ப - 
                   ᨢ  -    砥  ᥡ ᨬ 室 
                    ப.

                   ࠬ sys_nerr   ᮤন    ᫮    ⮢
                   ᨢ.

                      3  "    ६"   
                   ஡   ଠ       ६    errno,
                   sys_errlist, sys_nerr.

頥       .
祭

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

 ⠪     clrerr, eof, _strerror, strerror.

ਬ:

#include<stdio.h>

int main(void)
{
   FILE *fp;
   fp = fopen("perror.dat","r");
   if(!fp)
      perror("   䠩  ⥭.\n");
   return 0;
}


pieslice

㭪              訢 ᥪ 㣠.

⠪          #include <graphics.h>
                   void far pieslice(int x,int y,int stangle,
                                      int endangle,int radius);

, ᮤঠ騩   graphics.h
⨯

ᠭ           pieslice      訢  ᥪ  㣠  
                   業஬  窥 (x,y)   ࠤᮬ  radius.  
                     㣫 stangle  㣫 endangle.  
                   稢  ⥪騬  梥⮬      訢
                   ⥪騬   梥⮬   ᪨       ⥪饣
                   蠡.

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

                   砭. ᫨  ᯮ CGA  ஬
                   ,   ਬ    ᯮ짮  ᪨
                   㭪権,  ਢ  ⮩ ,    
                    १.  ᫨  ⥬ ࠡ⠥
                     CGA    ஬  ,   ᯮ
                   祭 1    ᨬ᪮ ⠭ 梥.
                       ன    ਢ    ਬ     
                   ᯮ짮   㭪権   pieslice,ਢ   
                   ࠧ  㭪樨  arc.  (  㭪樨  arc  ਢ
                   ⮫쪮  ਬ,   ⪠. ਬ.
                   .)

頥       .
祭

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

 ⠪     fillellipse, fill_patterns(塞 ⨯),
                   graphresult, sector, setfillstyle.

ਬ:

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

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
int midx,midy;
int stangle = 45,endangle = 135;
int radius = 100;

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

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
midx = getmaxx() / 2;
midy = getmaxy() / 2;
/* । ⨯ ᪨  ᮢ ᥪ */
setfillstyle(EMPTY_FILL,getmaxcolor());
pieslice(midx,midy,stangle,endangle,radius);

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


poke

㭪            뢠 祭    
                   segment:offset.

⠪          void poke(unsigned segment, unsigned offset,
                                                         int value);

, ᮤঠ騩   dos.h
⨯

ᠭ           㭪 poke 뢠  楫  祭  value  
                         segment:offset,   segment -
                    ᥣ, offset- ᬥ饭.

                   ᫨ 㭪  뢠    祭  䠩
                   dos.h,   ࠪ,   ப, 
                       ஥  .  ᫨   
                   砥  䠩  dos.h  (    믮  
                    㭪樨 ४⨢ #undef),   㤥 
                   㭪,   ப.

頥       .
祭

७ᨬ      㭪 㭨쭠  ᥬ⢠ ய஢
                   8086.

 ⠪     harderr, peek, pokeb.

ਬ:

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

int main(void)
{
   clrscr();
   cprintf(",  Scroll lock 몫祭,  \
             ...\n");
   getch();
   poke(0x0000,0x417,16);
   cprintf(" Scroll lock 祭. \n");
   return 0;
}


pokeb

㭪            頥      
                   segment:offset.

⠪          #include <dos.h>
                   void pokeb(unsigned segment, unsigned offset,
                                                         char value);

, ᮤঠ騩   dos.h
⨯

ᠭ           㭪 pokeb 뢠 祭    value  
                         segment:offset,   segment -
                    ᥣ, offset- ᬥ饭.

                   ᫨ 㭪  뢠    祭  䠩
                   dos.h,   ࠪ,   ப, 
                       ஥  .  ᫨   
                   砥 䠩 dos.h ( 믮    
                   㭪樨   ४⨢   #undef),     㤥  
                   㭪,   ப.

頥       .
祭

७ᨬ      㭪 㭨쭠  ᥬ⢠ ய஢
                   8086.

 ⠪     peekb, poke.

ਬ:

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

int main(void)
{
   clrscr();
   cprintf(",  Scroll lock 몫祭,  \
             ...\n");
   getch();
   pokeb(0x0000,0x417,16);
   cprintf(" Scroll lock 祭. \n");
   return 0;
}


polar

㭪            頥 ᭮  ᫮    ᮮ⢥⢨   
                   稭  㣫.

⠪          #include<complex.h>
                   complex polar(double mag, double angle);

, ᮤঠ騩   complex.h
⨯

ᠭ           polar(mag,angle) 筮 ࠦ:
                   complex(mag*cos(angle),mag*sin(amgle)).

頥       ᭮ ᫮,   ᮫⭮ -
祭             㣫.

७ᨬ       㭪樨 ॡ ++,  ⮬ -
                   ᨬ.

 ⠪     arg, complex, norm.

ਬ:

#include<stream.h>
#include<complex.h>

int main(void)
{
   double x = 3.1, y = 4.2;
   complex z = complex(x,y);
   cout << "z =" << z  << "\n";
   cout << " ⢥  = " << real(z) << "\n";
   cout << "   = " << imag(z) << "\n";
   cout << "z  ᭮ ᮯ殮 = " << conj(z) << "\n";

   double mag = sqrt(norm(z));
   double ang = arg(z);
   cout << "ୠ ଠ z:\n"
   cout << "稭 = " << mag << "\n";
   cout << " ( ࠤ) = " << ang << "\n";
   cout << "⠭  ୮ : \n";
   cout << "   z = " << polar(mag,ang) << "\n";
   return 0;
}


poly

㭪               㬥⮢ .

⠪          #include<math.h>
                   double poly(double x, int degree, double coeff[]);

, ᮤঠ騩   math.h
⨯

ᠭ           㭪 poly        x ⥯
                   degree  樥⠬ coeff[0], coeff[1],
                   ...coeff[n]. ਬ, ᫨ n=4, ᪮஢-
                     㤥 룫拉 ᫥騬 ࠧ:

                   coeff[4]x^4 + coeff[3]x^3 + coeff[2]x^2 +
                      coeff[1]x + coeff[0]

頥       㭪 poly 頥 ᫥   x
祭           祭 .

७ᨬ      㭪 ন  ⥬ UNIX.

ਬ:

#include<stdio.h>
#include<math.h>

/*  : x**3 - 2*x**2 + 5*x - 1 */

int main(void)
{
   double array[] = {-1.0,5.0,-2.0,1.0};
   double result;
   result = poly(2.0,3,array);
   printf(" x**3-2*x**2+5*x-1  x=2.0 ࠢ: %lf\n",
           result);
   return 0;
}


pow

㭪             x  ⥯ y.

⠪          ⢥ 
                   #include<math.h>
                   double pow(double x, double y);

                   ᭠ 
                   #include<complex.h>
                   complex pow(complex x,complex y);
                   complex pow(complex x,double y);
                   complex pow(double x,complex y);

, ᮤঠ騩   ⢥        ᭠ 
⨯           math.h                    complex.h

ᠭ           pow  x^y.

                   ᭠  । ᫥騬 ࠧ:

                   pow(base,expon) = exp(expon log(base))

頥        ᯥ譮 襭, pow 頥 ᫥-
祭            祭, x^y.

                   , 㬥   뫠   pow   뢠   
                   १ ९,      
                     ᫨.   ९,  pow 頥
                   祭 HUGE_VAL.   ᫨誮 讬  祭,
                   쭮    ६    errno    ᢠ
                   祭:

                   ERANGE -  室  ।.

                   ᫨ 㬥 x   ࠢ 0,   y   ࠢ
                   0,   ⮬ errno ᢠ 祭

                   EDOM - 訡  ।.

                    㭪 頥 祭 ⭮ HUGE_VAL.

                   ᫨  x  y ࠢ 0,  pow 頥 1.

                   ࠡ 訡  㭪樨  pow      
                    㭪樨 matherr.

७ᨬ      ⢥  pow 㯭  ⥬ UNIX 
                   ন  ⠭⮬  ANSI  C.   ᭠
                      ॡ   ++     ⮬  ᪮॥  ᥣ
                   ७ᨬ.

 ⠪     complex, exp, pow10, sqrt.

ਬ:

#include<stdio.h>
#include<math.h>

int main(void)
{
   double x = 4.0,y=3.0;
   printf("%lf  ⥯ %lf = %1f\n",x,y,pow(x,y));
   return 0;
}


pow10

㭪             10  ⥯ p.

⠪          #include<math.h>
                   double pow10(int p);

, ᮤঠ騩   math.h
⨯

ᠭ           pow10  10^p.

頥        ᯥ譮 襭 pow10 頥 ᫥-
祭            祭 10^p.

                       double.  㬥
                      ⨬묨,   ,   ᫨   뢠
                   ९.

७ᨬ      㯭  ⥬ UNIX.

 ⠪     exp, pow.

ਬ:

#include<stdio.h>
#include<math.h>

int main(void)
{
   int p=3;
/* !!!  ਣ double p = 3.0; ਬ. . */
   printf("10  ⥯ %d = %1f\n",p,pow10(p));
   return 0;
}


printf

㭪            ந ଠ஢ 뢮  stdout.

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


, ᮤঠ騩   stdio.h
⨯

ᠭ           printf 砥     㬥⮢,  ਬ  
                    ᮮ⢥  ᯥ䨪  ଠ  
                   ப format,   뢮 ଠ஢  
                   stdout.  ᫮ 㬥⮢    ᮮ⢥⢮
                    ᯥ䨪権 ଠ  format.

                              ப ଠ.

                   ப ଠ,  ।⠢      맮
                   㭪権  ᥬ⢠ ...printf,  ࠢ ⥬,  
                         㭪権    㤥    ८ࠧ뢠,
                   ଠ஢       ᢮  㬥.  
                   ଠ   筮  㬥⮢,  
                   १   ।묨,  ,  ᪮॥
                   ᥣ,  묨.  譨  㬥   (᫨   
                   ⢮ ,  祬 ॡ  ଠ) 
                   ஢.

                   ப ଠ -  ᨬ쭠 ப,  
                         ⨯  ꥪ⮢  -    ᨬ  
                   ᯥ䨪樨 ८ࠧ.

                   -   ᨬ   ७      뢮   
                     .

                   - 䨪樨   ८ࠧ   ਬ  
                     ଠ஢.

                           䨪樨 ଠ.

                   䨪樨 ଠ       㭪権    ᥬ⢠
                   ...printf  ᫥ :

                    %[䫠] [ਭ] [.筮] [F|N|h|l|L] type

                    ᯥ䨪  稭  ᨬ 業
                   (%). ᫥ 業 ᫥ ਧ  浪:

                   - 易⥫쭠    ᫥⥫쭮     [flags]
                     ᨬ-䫠;

                   - 易⥫쭠 ᯥ䨪 [width] ਭ;

                   - 易⥫쭠 ᯥ䨪 [.prec] 筮;

                   - 易⥫  䨪 [F|N|h|l|L] 室
                     ࠧ;

                   - ᨬ ⨯ ८ࠧ [type].

                        易⥫  ப ଠ.

                    ᠭ    ᭮    ࠢ    ࠢ
                   ଠ⮬,        易⥫    ᨬ,
                   ᯥ䨪樨  䨪樨  ଠ⭮ ப.


            ࠢ ଠ⮬
 ᯥ䨪    

 flags (䫠)   ࠢ 뢮,  ᫠, 筠
                  窠, 墮⮢ 㫨, 쬥  
                  䨪.
                 
 width (ਭ)   ᨬ쭮 ᫮ ⠥ ᨬ, 
                  ஡  㫨.
                 
 precision        ᨬ쭮 ᫮ ⠥ ᨬ;  楫
 (筮)       ᥫ ᨬ쭮 ᫮ .
                 
 size (ࠧ)    ⢥࣠ ࠧ 㬥  㬮砭
                  (N-  㪠⥫, F- 쭨 㪠⥫,
                   h- ⪮ 楫, l-  楫, L - long
                                                            double).



                ८ࠧ  ᥬ⢠ 㭪権
                                ...printf.

                    ᫥饩   ⠡        ᯨ᮪    ⨯
                   ८ࠧ,  室  ⨯ 㬥  室
                   ⨯ ᫥ ८ࠧ.

                   ଠ, ।⠢          ⠡
                   ।,   ଠ  ஬ ⨯
                   ८ࠧ,     ⠫   ࠪ⨪:
                   䫠,  ਭ,  筮, ࠧ. ⮡ 㢨,
                          뢮         ଠ
                    易⥫쭮 ᯥ䨪, ᬮ
                   ⠡, ᫥  .


         室     室 㬥
८ࠧ 㬥   


                           ᫮ 

     d          楫      楫 筮  
     i          楫      楫 筮  
     o          楫      楫 쬥筮  
     u          楫      楫 筮  
     x          楫      楫 ⭠筮  
                           ( 㪢 a, b, c, d, e, f)
     X          楫      楫 ⭠筮  
                           ( 㪢 A, B, C, D, E, F).
     f         饩  祭    ଥ [-]dddd.
                窮     dddd
     e         饩  祭    ଥ [-]d.dddd
                窮     e[+/-]ddd
     g         饩  祭     ଥ f, 
                窮      ଥ e,   祭  筮-
                           . ⮢ 㫨  筠 窠
                            ⮫쪮  室
     E         饩  ⠪ ,   砥 e, ⮫쪮  㪢
                窮     E  祭 ⥯
     G         饩  ⠪ ,   砥 g, ⮫쪮  㪢
                窮     E  祭 ⥯


                           .

     C         ᨬ쭮   ᨬ
     S         㪠⥫   ⠥ ᨬ   ,  
                ப    㫥 砭,  
                           㤥 ⨣ 筮.
     %          ᨬ ⠥ ⮫쪮  %.


                              ⥫

     n         㪠⥫   ࠭ ( , 㪠 
                楫    室 㬥) - ⮫쪮  -
                           ᠭ ᨬ.
     P         㪠⥫   ⠥ 室 㬥, 㪠⥫;
                           쭨 㪠⥫ , 
                           XXXX:YYYY,  㪠⥫ ,
                            YYYY (⮫쪮 ᬥ饭).


                                襭.

                    ᫥饩   ⠡   ᫥  
                   ᮣ襭, ᮯ஢騥  ᯥ䨪樨.


          襭

 e  E     㬥 ८ࠧ  ᮮ⢥⢨  蠡:
             [-]d.ddd...e[+/-]ddd, 
             -   । 筮 窥;
             - ᫮  ᫥ 筮 窨 ࠢ 筮;
             - ⥯ ᥣ ᮤন  .
    f        㬥 ८ࠧ     ᮮ⢥-
               蠡 [-]ddd.ddd...,  ᫮ 
              ᫥ ⮩ ࠢ 筮 (᫨  㫥
             筮).
 g  G     㬥 ⠥  ਭ樯 e, E  f,  筮-
             , 饩 ᫮  .
             ⮢ 㫨 㤠, 筠 窠 ⠢
             ⮫쪮  室.
             㬥 ⠥  ਭ樯 e  f ( 묨
             ࠭祭ﬨ), ᫨ ᨬ ८ࠧ g;  
             ਭ樯 E, ᫨ ᨬ ८ࠧ G.
             ਭ樯 e ᯮ ⮫쪮  ⮬ 砥, ᫨ ᯮ-
             , 祭  १  ) , 祬 -
             ; )  祬 -4.
 x  X      ८ࠧ ⨯ x -  뢮  㪢 a, b,
             c, d, e.
              ८ࠧ ⨯ X -  뢮  㪢 A, B,
             C, D, E.


                   砭. ।  祭     饩
                   窮    +INF  -INF.   ᫠ 
                   IEEE   +NAN  -NAN.

                              - 䫠.

                    - 䫠  (-),  (+), (#) 
                   (  );       浪 
                   樨.


               砥

   -         ࠢ १, ஡  ࠢ.
            ᫨  , १ ࠢ ࠢ, -
             ஡  ﬨ ᫥.
   +         ८ࠧ - १ ᥣ 稭 
             (+)  (-).
       ᫨ 祭 ⥫쭮, 뢮 稭  ஡-
              ; ⥫ 祭 ᥣ 稭-
               .
   #        ,  ८ࠧ㥬 㬥 ᯮ 
            "ୠ⨢" ଥ.  ᫥ ⠡.


                   ਬ砭.    ਮ  ஡
                     .

                   ୠ⨢ ଠ.

                   ᫨ 䫠  #  ᯮ         ᨬ
                   ८ࠧ,      ஢  㬥
                   (arg)   ᫥騩 १:


                 #   १
 ८ࠧ   

c, s, d, i, u       뢠 ﭨ.
      0            0 । 㫥 arg
    x  X        0x ( 0X) । arg
  e, E  f        ᥣ 㤥 ᮤঠ  -
                   ,  ᫨  窮  ᫥  .
                   筮, 筠 窠   १,
                   ⮫쪮 ᫨   ᫥ .
   g  G         筮 e  E,  ,  墮⮢
                   㫨  㤠.


                   䨪 ਭ.

                   䨪 ਭ    ⠭   
                   ਭ   뢮 祭.

                   ਭ     ᯮᮡ:

                   - ।⢥,   ப 
                     ;

                   -  ᢥ    (*).

                   ᫨  ᯮ  (*)  ᯥ䨪樨
                   ਭ,  ᫥騩  㬥     맮   㭪樨
                   (   楫) । 
                   ਭ  뢮  .
                   
                      筠 ਭ   
                     砥    ਢ   祭 .  ᫨
                   १ ,  祬  ਭ , 
                   㤥  த  室 ਭ.


 䨪            ਭ 뢮
 ਭ       

   n             ࠩ  n ᨬ. ᫨ 뢮-
                祭 , 祬 n ᨬ, 뢮 -
                ஡ (ࠢ ࠢ, ᫨  䫠
               "-",  ⨢ 砥 -  ࠢ).
   0n          ⠥  ࠩ  n ᨬ. ᫨ 뢮
               祭 ᮤন  n ᨬ,  
               ᫥ ﬨ.
   *           䨪 ਭ ⠢  ᯨ᪥ 㬥⮢
               । ᮮ⢥騬 㬥⮬.


                          䨪 筮.

                   䨪 筮 ᥣ  稭    窨
                   (.),  ⤥饩   ।饩 ᯥ䨪樨
                   ਭ.  ⥬ ᯥ䨪 筮 ⠪,   
                   ਭ,    ।⢥,   
                   ப  ,   ᢥ -  
                      窨   (*).   ᫨    ᯥ䨪樨
                   筮  ᯮ  窠  (*),  ᫥騩
                   㬥    맮  㭪樨  (易⥫쭮  楫)
                   । 筮.

                   ᫨  ᯮ 窨   筮
                    ਭ,     ᯥ䨪権,  㬥
                         ᫥      ।⢥      
                   ᮮ⢥騬 ᯥ䨪஬.


 䨪              뢮
 筮      

 ( )      筮 ⠭  㬮砭 (⠭⭮
                =1  ⨯ d, i, o, u, x, X;
                =6  ⨯ e, E, f;
                =  騥   ⨯ g, G;
                =  ࢮ 㫥 ᨬ  ⨯ S;
                     ⨯ c)
    .0           ⨯ d, i, o, u, x 筮 ⠭ 
                㬮砭.
                 ⨯ e, E, f 筠 窠  ⠥.
    .n           n ᨬ  n  ; ᫨
                뢮 祭 ᮤন  n ᨬ, 
                  祭  㣫. (  
                ,   ᨬ쭮 ⨯).
     *          䨪 筮   ᯨ᪥ 㬥⮢,
                祬  । 祭 ଠ㥬 -
                㬥.


                   砭. ᫨   㪠   㫥   筮,  
                   ᯥ䨪 ଠ  楫 祭 (..  d,
                   i,  o,  u, x),  ⠥ 祭 ࠢ 0,  
                   ⮬ 砥    뢮  ஢  ᨬ
                   (..  㤥 ⮥).


           ᯥ䨪 筮   ८ࠧ
८ࠧ 

     d          .n 뢠,  㤥 ⠭  ࠩ 
     i          n . ᫨ 뢮 㬥   n ,
     o          ᢮   뢮  ᫥ ﬨ.
     u          ᫨  뢮 㬥   n , -
     x          室 祭  ᥪ.
     X         
               
     e          .n 뢠,  ᫥ 筮 窨 㤥 -
     E          ⠭ n ᨬ, 祬 ᫥  -
     f          .
               
     g          .n ।,  㤥 ⠭ ᨬ쭮 n
                 .
     G         
               
     c          .n   ﭨ  뢮
               
     s          .n ।,  㤥 ⠭  , 祬
                 n ᨬ.


                       䨪 室 ࠧ.

                    - 䨪 室 ࠧ (F,  N, h, l
                      L)      ࠧ   ᫥饣   室
                   㬥:

                   F = 쭨 㪠⥫;
                   N =  㪠⥫;
                   h =  ⪮ 楫;
                   l =  楫;
                   L =   筮;

                   䨪 室 ࠧ (F,  N,  h,  l   L)
                       ,    ࠧ  㭪樨 ...printf
                      ⨯        ᮮ⢥饣
                   室   㬥   arg.  䨪  F    N
                   ਬ ⮫쪮  ⥬ 室  㬥⠬  arg,
                     ।⠢  ᮡ  㪠⥫ (%p,  %s 
                   %n).  䨪 h, l  L ਬ  ᫮
                   㬥⠬ (楫   饩 窮).

                    䨪  F    N    室
                   㬥 arg.  筮,   ८ࠧ %p, %s,
                     %n  㬥 arg -  㪠⥫ ⠭⭮
                   ࠧ    ᮮ⢥饩    .   F
                   砥:   "஢   arg,    쭨
                   㪠⥫".  N 砥: "⥯஢ arg, 
                    㪠⥫".

                   䨪 h, l  L ⢥࣠ ⠭ ࠧ
                   ᫮    室  㬥⮢:   l      L
                   ਬ  楫 ⨯  (d,  i,  o, u, x,
                   X)  ⨯   饩 窮 (e, E, f, g 
                   G),      ६  h ਬ ⮫쪮  楫
                   .   h,   l-  䨪    뢠
                      ﭨ      ⨯  ᨬ(c,s)  
                   㪠⥫(p,n).


 䨪               㬥
室 ࠧ  

      F            㬥 arg ⠥,  쭨 㪠⥫.
      N            㬥 arg ⠥,   㪠⥫.
                    ᢥ-   N    -
                   짮    ⨯ ८ࠧ.
      h             ⨯ ८ࠧ d, i, o, u, x, X 㬥
                   arg ,  ⪮ 楫;
      l             ⨯ ८ࠧ d, i, o, u, x, X 㬥
                   ,   楫;
                    ⨯ ८ࠧ e, E, f, g, G 㬥 -
                     ᫮  筮.
      L             arg     -
                     ⨯ ८ࠧ e, E, f, g, G.



頥        㭪 頥 ⢮ 뢮
祭           .  砥 訡 printf 頥 EOF.

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

 ⠪     cprintf, ecvt, fprintf, fread, fscanf, putc, puts,
                   putw, scanf, sprintf, vprintf, vsprintf.

ਬ:

#define I 555
#define R 5.5

int main(void)
{
   int i, j, k, l;
   char buf[7];
   char *prefix = &buf;
   char tp[20];
   printf("prefix   6d   6o   8x   10.2e   10.2f\n");
   strcpy(prefix, "%");
   for (i=0; i<2; i++){
     for (j=0; j<2; j++)
      for (k=0; k<2; k++)
       for (l=0; l<2; l++)
       {
         if (i==0)  strcat(prefix,"-");
         if (j==0)  strcat(prefix,"+");
         if (k==0)  strcat(prefix,"%");
         if (l==0)  strcat(prefix,"0");
         printf("%5s !",prefix);
         strcpy(tp, prefix);
         strcat(tp, "6d !");
         printf(tp, I);
         strcpy(tp,"");
         strcpy(tp, prefix);
         strcat(tp, "6o !");
         printf(tp, I);
         strcpy(tp,"");
         strcpy(tp,prefix);
         stpcat(tp, "8x !");
         printf(tp,I);
         stpcry(tp,"");
         stpcry(tp, prefix);
         strcat(tp, "10.2e !");
         printf(tp, R);
         strcpy(tp, prefix);
         strcat(tp, "10.2f !");
         printf(tp,R);
         printf(" \n");
         stpcry(prefix, "%");
        }
   }
}

prefix     6d    6o      8x        10.2e       10.2f
%-+#0 !+00555 !01053  !0x0022b  !+5.50e+000 !+000005.50 !
 %-+# !+555   !01053  !0x22b    !+5.50e+000 !+5.50      !
 %-+0 !+00555 !01053  !000022b  !+5.50e+000 !+000005.50 !
  %-+ !+555   !1053   !22b      !+5.50e+000 !+5.50      !
 %-#0 !000555 !001053 !0x00022b !05.50e+000 !0000005.50 !
  %-# !555    !01053  !0x22b    !5.50e+000  !5.50       !
  %-0 !000555 !001053 !0000022b !05.50e+000 !0000005.50 !
   %- !555    !1053   !22b      !5.50e+000  !5.50       !
 %+#0 !+00555 ! 01053 ! 0x0022b !+5.50e+000 !+000005.50 !
  %+# !  +555 ! 01053 !   0x22b !+5.50e+000 !     +5.50 !
  %+0 !+00555 ! 01053 ! 000022b !+5.50e+000 !+000005.50 !
   %+ !  +555 !  1053 !     22b !+5.50e+000 !     +5.50 !
  %#0 !000555 !001053 !0x00022b !05.50e+000 !0000005.50 !
   %# !   555 ! 01053 !   0x22b ! 5.50e+000 !      5.50 !
   %0 !000555 !001053 !0000022b !05.50e+000 !0000005.50 !
    % !   555 !  1053 !     22b ! 5.50e+000 !      5.50 !


putc

㭪            뢮 ᨬ  ⮪.

⠪          #include <stdio.h>
                   int putc(int c, FILE *stream);

, ᮤঠ騩   stdio.h
⨯

ᠭ           㭪 putc   ।⠢   ᮡ  ப,
                    뢮  ᨬ  c    㪠  室
                   ⮪ stream.

頥        ᯥ譮 襭 㭪 putc, 
祭           ᨬ c.   訡 㭪
                    祭 EOF.

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

 ⠪     fprintc, fputc, fputch, fputchar, fputs, fwrite,
                   getc, getchar, printf, putch, putchar, putw,
                   vprintf.

ਬ:

#include<stdio.h>

int main(void)
{
   char msg[] = "Hello world";
   int i=0;
   while(msg[i])
      putc(msg[i++],stdout);
   return 0;
}


putch

㭪            뢮 ᨬ  ࠭.

⠪          #include<conio.h>
                   int putch(int c);

, ᮤঠ騩   conio.h
⨯

ᠭ           putch 뢮  ᨬ  c  ⥪饥 ⥪⮢ .
                    㭪 ந 뢮    ⥪⮢  ०
                   ।⢥   ᮫.  putch  ८ࠧ
                   ᨬ  ॢ  ப  (\n)    :   ॢ
                   ப,  ⪨.

                   뢮 ⢫    אַ    ,
                         㭪権  BIOS,   ᨬ 
                   祭 쭮 ६ directvideo.

頥        ᯥ譮 襭 putch 頥 뢥-
祭            ᨬ c.  訡  頥 EOF.

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

 ⠪     cprintf, cputs, getch, getche, putc, putchar.

ਬ:

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

int main(void)
{
   char ch = 0;
   printf(" ப:");
   while(ch != '\r')
   {
      ch = getch();
      putch(ch);
   }
   return 0;
}


putchar

㭪            뢮 ᨬ  ⮪ stdout.

⠪          #include <stdio.h>
                   int putchar(int c);

, ᮤঠ騩   stdio.h
⨯

ᠭ           putchar  ப, । 
                   putc(ch,stdout);

頥        ᯥ譮 襭 putchar 頥 뢥-
祭            ᨬ c.  訡  頥 EOF.

७ᨬ      putchar 㯭  ⥬ UNIX  ন
                   ⠭⮬ ANSI C. । ⠪  ୨ 
                   .

 ⠪     fputchar, getc, getchar, printf, putc, putch, puts,
                   putw, vprintf.

ਬ:

#include<stdio.h>

/* ।  ᨬ, ।祭  ᮢ
   ࠬ */
#define LEFT_TOP  0xDA
#define RIGHT_TOP 0xBF
#define HORIZ     0xC4
#define VERT      0xB3
#define LEFT_BOT  0xC0
#define RIGHT_BOT 0xD9

int main(void)
{
   char i,j;
   /* ᮢ   ࠬ */
   putch(LEFT_TOP);
   for(i=0;i<10;i++)
      putch(HORIZ);
   putch(RIGHT_TOP);
   /* ᮢ 業ࠫ  */
   for(i=0; i<4; i++)
   {
      putch(VERT);
      for(j=0;j<10;j++)
         putch(' ');
      putch(VERT);
      putch('\n');
   }
   /* ᮢ   ࠬ */
   putch(LEFT_BOT);
   for(i=0;i<10;i++)
      putch(HORIZ);
   putch(RIGHT_BOT);
   putch('\n');
   return 0;
}


putenv

㭪             ப ᨬ  ⥪饥 ᠭ
                   ।.

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

, ᮤঠ騩   stdlib.h
⨯

ᠭ           putenv 砥  ப  name        
                   ᠭ । ⥪饣 . ਬ:

                       putenv("PATH=C:\\TC");

                   putenv   ⠪  ᯮ짮   䨪樨
                    㤠  㦥    ६  ।
                   ⥪饣   .     㤠    
                     ६ ( ਬ "MYVAR=").

                   putenv  ।  ⮫쪮  ⥪饣  .
                    襭  ⠭ 室
                   ।.

                   砭. ப, । putenv  
                   쭮  ᪮.   砥, ᫨ ப
                   뫠 쭮  ᪮,    ᢮
                    ਢ  ।᪠㥬 १.

頥        ᯥ譮 襭 putenv 頥 0, 
祭           訡 -1.

७ᨬ      putenv 㯭  ⥬ UNIX.

 ⠪     getenv.

ਬ:

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

int main(void)
{
   char *path, *ptr;
   int i=0;
   /*  祭 ६ । PATH */
   ptr = getenv("PATH");
   /* ᮧ  祭 */
   path = malloc(strlen(ptr)+15);
   strcpy(path,"PATH=");
   strcat(path,ptr);
   strcat(path,";c:\\temp");
   /*    ६ */
   putenv(path);
   while(environ[i])
      printf("%s\n",environ[i++]);
   return 0;
}


putimage

㭪            뢮  ࠭ ⮢ ࠧ.

⠪          #include <graphics.h>
                   void far putimage(int left,int top,
                                      void far *bitmap,int op);

, ᮤঠ騩   graphics.h
⨯

ᠭ           putimage 頥 ⮢ ࠧ, ࠭ ࠭
                     getimage,  ⭮  ࠭,    
                   孨  㣮 ࠧ 室  窥 (left,top).
                   bitmap 㪠뢠    ஬ ࠭
                   ॡ㥬 ࠧ.

                   ࠬ op । ⠢ , 
                   ।   ᫥  梥      窨
                   (pixel) ࠭, ᭮뢠  饩 㦥 
                   ࠭  窥    ᮮ⢥饩  窥  ࠧ 
                   .

                   祭 祭 putimage_op  (  ।  
                   graphics.h)   ᫥騬 :

                   
                             .       
                   
                   COPY_PUT      0          
                   XOR_PUT       1          ᪫饥 ""
                   OR_PUT        2          ""
                   AND_PUT       3          "  "
                   NOT_PUT       4           筨 
                                            ᨥ
                   

                   㣨 ᫮, COPY_PUT ᪮  ࠧ
                   筨    ࠭,  XOR_PUT  믮  
                        㦥  室饬    ࠭
                   ࠧ,  OR_PUT  믮       㦥
                   室饬  ࠭ ࠧ  ..

頥       .
祭

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

 ⠪     getimage, imagesize, putpixel, setvisualpage.

ਬ:

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

#define ARROW_SIZE 10

void draw_arrow(int x,int y);

int main(void)
{
int graphdriver = DETECT, gmode, errorcode;
void *arrow;
int x,y,maxx;
unsigned int size;

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

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
maxx = getmaxx();
x = 0;
y = getmaxy()/2;
/* ᮢ ६頥 ꥪ */
draw_arrow(x,y);
/* । ࠧ ,  ࠭ ࠦ */
size = imagesize(x,y-ARROW_SIZE,x+(4*ARROW_SIZE),y+ARROW_SIZE);
/* 뤥  */
arrow = malloc(size);
/*  ࠦ */
getimage(x,y-ARROW_SIZE,x+(4*ARROW_SIZE),y+ARROW_SIZE,arrow);
/* த,   㤥   */
while(!kbhit())
{
   /*   ࠧ */
   putimage(x,y-ARROW_SIZE,arrow,XOR_PUT);
   x += ARROW_SIZE;
   if(x >= maxx)
      x = 0;
   /* ᮢ ࠦ */
   putimage(x,y-ARROW_SIZE,arrow,XOR_PUT);
}

free(arrow);
closegraph();
return 0;
}

void draw_arrow(int x,int y)
{
   /* ᮢ  ࠭ ५ */
   moveto(x,y);
   linerel(4*ARROW_SIZE,0);
   linerel(-2*ARROW_SIZE,-1*ARROW_SIZE);
   linerel(0,2*ARROW_SIZE);
   linerel(2*ARROW_SIZE,-1*ARROW_SIZE);
}


putpixel

㭪            뢮 ᥫ    ࠭.

⠪          #include <graphics.h>
                   void far putpixel(int x, int y,int color);

, ᮤঠ騩   graphics.h
⨯

ᠭ           putpixel ⮡ࠦ      梥   color     
                   न⠬ (x,y).

頥       .
祭

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

 ⠪     getpixel, putimage.

ਬ:

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


puts

㭪            뢮 ப  ⮪ stdout.

⠪          #include<stdio.h>
                   int puts(const char *s);

, ᮤঠ騩   stdio.h
⨯

ᠭ           㭪 puts    ப  ᨬ  㫥
                   砭  ⠭  室  ⮪  stdout,
                   祬     ᨬ 室  
                   ப.

頥        ᯥ譮 襭, 㭪 puts 㫥
祭           祭.  ⨢ 砥 頥 EOF.

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

 ⠪     cputs, fputs, gets, printf, putchar.


puttext

㭪             ⥪      ࠭,    ⥪⮢
                   ०.

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

, ᮤঠ騩   conio.h
⨯

ᠭ           puttext 頥   ᮤন       ,
                   㥬  ࠬ஬ source,   אַ㣮쭨 
                   ࠭, ।塞 ࠬࠬ left, top, right,
                   bottom.

                    न   ᮫묨  न⠬
                   ࠭,    ⥪⮢ .   孨 㣮
                   ࠭  न (1,1).

                   puttext ࠧ頥    ࠭  ᮤন   
                   ᫥⥫쭮, ᫥  ࠢ  ᢥ .

                   puttext ࠡ⠥    ⥪⮢ ०  ந
                   ।⢥ 뢮  ࠭.

頥        ᯥ譮 襭 puttext 頥 㫥-
祭            祭.  訡 ( ਬ, ᫨ 㪠-
                    न   । ࠭  -
                    ०) puttext 頥 0.

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

 ⠪     gettext, movetext, window.


putw

㭪            頥  ⮪ 楫 祭.

⠪          #include <stdio.h>
                   int putw(int w, FILE *stream);

, ᮤঠ騩   stdio.h
⨯

ᠭ           putw 뢮   楫    㪠  ⮪.  
                   㭪    뢠           
                   ᯥ樠쭮 ࠢ  䠩.

頥        ᯥ譮 襭 putw 頥 뢥
祭           楫 w.  訡 頥 EOF.

                   .. EOF   ⨬ 楫 祭,  
                     ।  訡   㦭   ᯮ짮
                   㭪樥 ferror.

७ᨬ      㭪 ন  ⥬ UNIX.

 ⠪     getw, printf.

ਬ:

#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;
}

