

                     2.        


               ABORT

            #include <process.h>  ॡ ⮫쪮  
                                  㭪樨
            #include <stdlib.h>   ᯮ    <process.h>,
                                   <stdlib.h>
            void abort();

               ᠭ.

               㭪  abort  ᯥ뢠  ᮮ饭  "Abnormal program
         termination" (਩ (।) 襭 ணࠬ)  
         stderr,  ⥬ 稢 맢 ,  ࠢ
         ,  樨஢ 맢  (筮  -
          ⥬). 㭪 abort    ⮪.

               頥 祭.

               頥  室 3  parent-    -
         樮 ⥬.
               .⠪  execl,  execle,  execip,  execlpe, execv, execve,
         execvp, execvpe, exit, _exit, signal, spawnl,  spawnle,  spawnlp,
         spawnlpe, spawnv, spawnve, spawnvp, spawnvpe.

               ਬ:

            #include <stdio.h>

            main(args, argv)
            int argc;
            char *argv[];
            {
            FILE *stream;
            if ((stream=fopen(argv[argc-1],"r"))==NULL) {
               frpintf(stderr,
                       "%s couldn't open file %s\n", argv[0],
                       argv[argc-1]);
               abort();
               }

               /*  砭.   ணࠬ ࠭  argv[0] ⮫쪮 
         ᨨ MS DOS 3.0  ;  ࠭    argv[0]  ᮤন
         ப "". */

               }

               ࠧ  ப:

               update employ.dat

                室:


            C:\BIN\UPDATE.EXE  couldn't open file employ.dat.

               Abnormal program termination.
               (। 襭 ணࠬ).

               ABS

            #include <stdlib.h>          ॡ   ⮫쪮    
                                          㭪樨
            int abs(n);
            int n;                       楫 祭

               ᠭ.

               㭪  abs  頥  ᮫⭮ 祭 ᢮ 楫
         㬥 n.

               頥 祭.

               㭪 abs 頥 ᮫⭮ 祭 ᢮  㬥-
         . 頥 祭  砥 訡 .
               . ⠪ cabs, fabs, labs.

               ਬ:

            #include <stdlib.h>

            int x = -4, y;

            y = abs(x);
            printf("%d\t%d\n", x, y);.

                室:

            -4       4.


               ACCESS

            #include <io.h>          ॡ ⮫쪮  
                                     㭪樨

            int access(pathname, mode);
            char *pathname;          path- 䠩  ४
            int mode;                ࠧ襭 

               ᠭ.

                 䠩  㭪  access ।,   
         । 䠩,     㯥      ०
         mode.    祭 mode   祭  맮 access
         ਢ .


                          

                06         ஢ઠ         ⥭   
                           

                04         ஢ઠ         ⥭

                02         ஢ઠ         

                00         ஢ઠ   ⮫쪮  ⢮


                MS DOS  騥 䠩    ⥭, -
         ⮬ ० 00  04 ࠡ뢠     १. -
         筮, ० 06  02  묨, ᪮  MS DOS
            ।   ⥭.
                ४ਥ access ।,      -
           ४ਨ;    ࠢ MS DOS  ४ਨ 
           ⥭  .

               頥 祭.

               㭪 access 頥 祭 0, ᫨ 䠩    -
           ०  mode.  頥  祭 -1 ᢨ⥫ 
         ⮬,   䠩    㯥    
         mode,  errno ⠭    ᫥ 祭:

                              

            EACCES                 饭; ⠭  
                                   䠩   ᪠   -
                                 㯠

            ENOENT                 path-  


               .⠪ chmod, fstat, open, stat.

               ਬ:

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

            int fh;
            .
            .
            .
            /* ஢ઠ 㯠   */
            if ((access("data",2))==-1 {
                   perror("data file not writable");
                   exit(1);
                   }

            else
                   fh=open("data", O_WRONLY);



               ACOS

            #include <math.h>

            double acos(x);
            double x;

               ᠭ.

               㭪 acos aa aપᨭ x  a  0  n.
         a祭 x    -1  1.

               aa a祭.

               㭪 acos aa १a aપᨭa. ᫨ x -
          -1   1, acos aaa errno  EDOM, aa -
         饭  訡 DOMAIN  stderr  aa 0.
               aa 訡    ஢aa    
         楤 matherr.
               .a asin, atan, atan2, cos, matherr, sin, tan.

               ਬ:

                ᫥饬 ਬ ணaa a a  a 
          , a  a祭  㤥  a  -1  1.

            #include <math.h>

            int errno;

            main()
                {
                float x,y;

                for (errno=EDOM;errno==EDOM;y=acos(x)) {
                    printf("Cosine=");
                    scanf("%f",&x);
                    errno = 0;
                    }
                printf("Arc cosine of %f = %f\n",x,y);
                }

            a 뢮a:

            Cosine = 3
            acos: DOMAIN error
            Cosine = -1.0
            Arc cosine of -1.000000 = 3.141593


               ALLOCA

            #include <malloc.h>    ॡ ⮫쪮  
                                   㭪樨


            char *alloca(size);
            unsigned size;         墠祭   ⥪

               ᠭ.

               楤 alloca 墠뢠  size  ⥪ ணࠬ.
         墠祭  ࠭⢮  ⮬᪨ ᢮  室
          㭪樨, 맢襩 alloca.

               頥 祭.

               楤 alloca 頥 㪠⥫ char    墠祭
         ࠭⢮.
                 ,    㪠뢠 頥 祭, -
         ࠭஢ ࠢ  ࠭  ⨯ ꥪ.  ⮡
           㪠⥫  ⨯, ⫨  char, ᯮ ८-
         ࠧ⥫ ⨯  頥  祭.  頥  祭
         NULL, ᫨ ࠭⢮  뫮 墠祭.
               .⠪ calloc, malloc, realloc.

               ।०.  祭 㪠⥫, 頥 楤-
         ன alloca,    㬥⮬  free.   alloca -
         ࠡ뢠 ⥪,   ᯮ짮 ⮫쪮    -
           뤥     ᯮ짮  ࠦ--
          㭪権.

               ਬ:

            #include <malloc.h>
            int *intarray;

            /* 墠뢠   ⥪  10 楫 */

            intarray=(int*)alloca(10*sizeof(int));


               ASCTIME

            #include <time.h>

            char *asctime(time);
            struct tm *time;       㪠⥫  ,
                                     <time.h>

               ᠭ.

               㭪  asctime ८ࠧ ६, ࠭  ,
          ᨬ ப. 祭 time 筮  砥    맮
         gmtime    localtime,   㪠⥫  
         tm,   <time.h> (c. gmtime  ᠭ   -
           tm).   ப, ࠡ⠭ asctime, ᮤন
         26 ᨬ   , ਢ   ਬ:

               Mon Jan 02 02:03:55 1980\n\0


               ᯮ 24 .       ﭭ  ਭ.
            ப ('\n')  㫥 ᨬ ('\0')   
         ᫥ 樨  ப.

               頥 祭.

               㭪 asctime 頥 㪠⥫   ᨬ  ப
         १. 頥 祭  砥 訡 .
               .⠪ ctime, ftime, gmtime, localtime, time, tzset.

               砭. 㭪樨 asctime  ctime ᯮ    
         ᪨ 墠祭   ࠭   ப १-
         .  맮     楤  㭨⮦  १
         ।饣 맮.

               ਬ:

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

            struct tm *newtime;
            long ltime;
            .
            .
            .
            time(&ltime);  /* ६  ᥪ㭤*/
            newtime=localtime(&ltime); /*८ࠧ  
                                        tm      ⭮
                                        ६   ப*/
            printf("the current date and time are %s\n",
                 asctime(newtime));


               ASIN

            #include <math.h>

            double asin(x);
            double x;

               a.

               㭪  asin  ᨭ x  ࢠ -n/2  n/2.
         祭 x    -1  1.

               頥 祭.

               㭪 asin 頥 १ ᨭ. ᫨ x  
         -1    1, asin ⠭ errno  EDOM, ⠥ ᮮ-
         饭  訡 DOMAIN  stderr  頥 0.
               aa 訡    ஢aa    
         楤 matherr.
               .a acos, atan, atan2, cos, matherr, sin, tan.


               ਬ:

            #include <math.h>

            int errno;

            main()

               {
               float x,y;
               for (errno=EDOM; errno==EDOM; y=asin(x)) {
                    printf("Sine=");
                    scanf("%f", &x);
                    errno = 0;
                            }
               printf("Arc sine of %f\n",x,y);
               }

                室:

            Sine = -1.001
            asin: DOMAIN error
            Sine = -1
            Arc sine of -1.000000=-1.570796


               ASSERT

            #include <assert.h>

            void assert(expression);

               ᠭ.

               楤  assert  ⠥ ᪮ ᮮ饭  -
         蠥 맢 , ᫨ expression ,  0.  -
         ᪮ ᮮ饭  :

            Assertion failed:  file <filename>, line <linenumber>,

          filename  -    室 䠩, linenumber -  ப,
          訡筠.
               ᫨ expression ⨭ (㫥),   ⢨  
         믮.
               楤 assert 筮 ᯮ  㦥  -
         ᪨ 訡  ணࠬ. ࠦ expression   -
           ⠪ ࠧ, ⮡  뫮 ⨭, ᫨ ணࠬ 믮-
           祭. ᫥ ⮣    ⫠  ணࠬ,  
           ᯮ짮 ᯥ樠 "no debug" 䨪 NDEBUG 
         㤠 맮 assert  ணࠬ. ᫨ NDEBUG ।  (-
           祭)  樥    ப  /D     ४⨢
         #define, ९ 몠  㤠  맮 assert    -
         室 ணࠬ.

               頥 祭.


               頥 祭 .

               砭. 楤 assert ॠ  .

               ਬ:

            #include <stdio.h>
            #include <assert.h>

            analyse_string (string)
            char *string;

            {
           /*  ஢ઠ ப । ࠡ⪮  */

            assert (string != NULL);      /*     NULL,
                                                  
                                            ப */
            assert (*string != '\0');     /*          
                                             ⮩ */
            .
            .
            .
            }.


               ATAN - ATAN2

            #include <math.h>

            double atan(x);      ⠭ x
            double x;

            double atan2(y,x);   ⠭ y/x
            double x;
            double y;

               ᠭ.

                 㭪樨 atan  atan2  १ ⠭.
         ᫨  㬥 atan2 ࠢ 0, 㭪 ⠭  errno  
         EDOM,  ⠥  ᮮ饭  訡 DOMAIN  stderr  頥
         0.
               aa 訡      ஢aa    ᯮ-
         a 楤 matherr.
               .a acos, asin, cos, matherr, sin, tan.

               ਬ:

            #include <math.h>

            printf("%.7f\n", atan(1.0));            /* n/4 */
            printf("%.7f\n", atan2(-1.0,1.0));     /* -n/4 */


                室:

            0.7853982
            -0.7853982


               ATOF-ATOL

               #include <match.h>     ᯮ   <match.h>,
               #include <stdlib.h>     <stdlib.h>.

               double atof (string);  ८ࠧ ப  string 
                                      double

               char *string           ப,   ८-
                                      
               int atoi (string)      ८ࠧ ப string  
                                      int

               long atol (string)     ८ࠧ ப string  
                                      long

               char *string           ப,   ८-
                                      

               ᠭ.

                㭪樨 ८ࠧ ᨬ ப  祭  -
         饩  窮    筮 (atof),  楫 祭 (atoi)
            楫 祭 (atol).
               室 ப string  ।⠢  ᮡ  ᫥⥫-
           ᨬ,    ஢  ᫮
         祭 । ⨯.
               㭪 ४頥 ⥭ 室 ப   ⮫쪮  -
             ᨬ,      ਭ  
         ᫠ (   NULL-ᨬ, 騩 ப).
               㭪 atof ।,  ப string   ᫥-
          :

               [whitespace][sign][digits][{d|D|E}[sign]digits]  ,

           [whitespase]  ⮨  ஡  /    ⠡樨,
          ; [sign] 砥 "+"  "-";  [digits]   -
         -    ᪮쪮  . ᫨ । 筮 -
           ,        ᫥ .  -
               ᫥  ⥫ ⥯, 
         ⮨  㪢 (d,D,e  E)  筮 楫  .
               㭪樨 atoi  atol  ࠡ뢠    窨  
         ⥫ ⥯. 㬥 string   㭪権  :

               [whitespace][sign]digits     ,

           whitespace,  sign,  digits   ,    atof.

               頥 祭.


                 㭪権 頥 祭 ⨯ double, int  
         long,  砥  १ 樨 室 ᨬ 
         ᥫ.

               頥 祭 ࠢ 0 (0L  atol), ᫨  室  
             ८ࠧ    祭  ⨯. 頥
         祭  ।  砥  ९.
               . ⠪ ecvt, fcvt, gcvt.

               ਬ:

               騥  ਬ 뢠,  ᫠, ᠭ  
         ப,   ८ࠧ  ᫮ 祭  ᯮ짮-
          㭪権 atof, atoi, atol:

               #include <math.h>

               extern long atol (\ );
               main (\ )
                     {
                     char *s;
                     double x;
                     int i;
                     long l;

                     s=" -2309.12E-15";
                     x=atof(s);
                     printf("%e\t",x);

                     s="7.8912654773d210";
                     x=atof(s);
                     printf("%e\t",x);

                     s="-9885";
                     i=atoi(s);
                     printf("%d\t",i);

                     s="98854 dollars";
                     l=atol(s);
                     printf("%ld\n",l);
                     }

               BDOS

            #include <dos.h>

            int bdos(dosfn, dosdx, dosal);
            int dosfn;                         㭪樨
            unsigned int dosdx;               祭 ॣ DX
            unsigned int dosal;               祭 ॣ AL

               ᠭ.

               㭪 bdos 믮 ⥬ 맮 MS DOS,   -

         ண ।  dosfn, ᫥ ࠧ饭 ᮮ⢥⢥  ॣ-
          DX  AL 祭 dosdx  dosal. 㭪 bdos 믮 -
          INT 21H  ⢫ ⥬ 맮.
               㭪   bdos       ᯮ짮    맮
         DOS-⥬ 맮,   ਭ 㬥⮢   ⮫-
          ਭ   ॣ DX(DH,DL) / AL.

               頥 祭.

               㭪 bdos 頥 祭 ॣ AX,  
         ⥬ 맮.
               .⠪ intdos, intdosx.

               砭.  맮   ᯮ짮  -
          ⥬ 맮,   㪠뢠 訡 ।⢮
         ⠭  䫠  ७.  .. -ணࠬ   㯠 
         ⮬ 䫠,  頥 祭     ।-
         .  ⮬ 砥 ᯮ 㭪 intdos.

               ਬ:

                 ᫥饬  ਬ 뢮 ᪠ 9 㭪樥 MS DOS
         (뢮 ப). ᪮ 祭 ॣ AL    -
         室,    । 0.  ਬ ࠡ⠥ ࠢ쭮 ⮫쪮
            ।  , ⠪  bdos   -
          ᥣ⮢ ॣ஢.

            #include <dos.h>

            char *buffer = "Enter file name :$";

            /* AL   室, ⮬ । 0 */

            bdos(9,(unsigned)buffer,0);

               BESSEL

            #include <math.h>

            double j0(x);

            double j1(x);

            double jn(n,x);

            double y0(x);

            double y1(x);

            double yn(n,x);

            double x;           祭  饩 窮
            int n;              楫 冷


               ᠭ.

               楤 j0, j1, jn  ᮮ⢥⢥ 㭪樨  -
         ᥫ ࢮ ⥯ 浪 - 0, 1  n.
               楤  y0, y1, yn  ᮮ⢥⢥ 㭪樨 -
         ᥫ ன ⥯ 浪 - 0,1  n. 㬥 x   -
         ⥫.

               頥 祭.

                㭪樨  १ 㭪権 ᥫ  x. -
          x  ⥫  y0, y1, yn, 楤  ⠭-
          errno  EDOM, ⠥ ᮮ饭  訡 DOMAIN  stderr 
         頥 ⥫쭮 祭 HUGE.
               aa  訡     ஢aa  
         楤 matherr.
               .⠪ matherr.

               ਬ:

            #include <math.h>

            double x, y, z;
            .
            .
            .
            y = j0(x);
            z = yn(3,x);


               BSEARCH

            #include <search.h>    ॡ ⮫쪮  
                                   㭪樨

            char *bsearch(key,base,num,width,compare);
            char *key;              ᪠
            char *base;            㪠⥫    ᪮   
                                   
            unsigned num,width;    ᫮  ࠧ ⮢
            int (*compare)();      㪠⥫  㭪  ࠢ

               ᠭ.

               㭪 bsearch ந    ஢
         ᨢ  num ⮢, ࠧ      ࠢ  width
         .  Base  -  㪠⥫  砫 ᨢ, key - 祭 
         ᪠.
               㬥 compare  㪠⥫  楤,  ⠢-
         塞  짮⥫,   ࠢ   ᨢ 
         頥 祭, ।饥  ⭮襭.  祭  ᪠
         㭪  bsearch    뢠 楤 compare   -
         쪮 ࠧ, ।   맮 㪠⥫     
         ᨢ. 楤  ࠢ ,  ⥬ 
           ᫥ 祭.


                           

             0         element1 , 祬 element2

               0             element1 ࠢ element2

             0         element1 , 祬 element2


               頥 祭.

               㭪  bsearch  頥  㪠⥫  ࢮ 宦
          key  ᨢ,   㪠뢠 base.
               ᫨ key  , 㭪 頥 NULL.
               . ⠪ lfind, lsearch, gsort.

               ਬ:

               /* 㭪 bsearch ந      -
           ᨢ      "key"    頥 㪠⥫ 
         ,  ன 室  key,  頥 NULL, -
           . */

            #include <search.h>
            #include <string.h>
            #include <stdio.h>
            int compare();

               /*     㭪 */

            main (argc, argv)
                 int argc;
                 char **argv;
                 {

                  char **result;
                  char *key = "PATH";

               /* ᫥騩    室  㬥,  稭騩  
         "PATH",  ।,  㬥 ᨪ᪨ -
         ஢ */

                  result = (char **)bsearch((char *)&key,
                           (char *)argv, argc, sizeof(char *),
                           compare);
                  if (result)
                     printf ("%s found\n", *result);
                  else
                     printf("PATH not found!\n");
                 }

            int compare (arg1, arg2)
                char **arg1, **arg2;

                {

                 return(strncmp(*arg1, *arg2, strlen(*arg1)));
                }.

               CABS

            #include <math.h>

            double cabs(z);
            struct  complex  z;  ᮤন  ⢥    
                                 

               ᠭ.

               㭪  cabs    ᮫⭮  祭 ᭮
         ᫠. ᭮ ᫮   ன  ⨯  complex,
           <math.h>, ᫥騬 ࠧ:
            struct complex  {
                    double x,y;
                    };

               맮 cabs ⥭ ᫥饬:

               sgrt(z.x*z.x + z.y*z.y)

               頥 祭.

               㭪 cabs 頥 ᮫⭮ 祭  ᠭ -
         .   ९ 㭪 뢠 楤 matherr, -
         頥 祭 HUGE  ⠭ errno  ERANGE.
               .⠪ abs, fabs, labs.

               ਬ:

            #include <math.h>

            struct complex value;
            double d;

            value.x = 3.0;
            value.y = 4.0;

            d = cabs(value);


               CALLOC

            #include <malloc.h>    ॡ ⮫쪮  
                                   㭪樨

            char *calloc(n,size);
            unsigned n;            ⢮ ⮢
            unsigned size;             
            ᠭ

               㭪 calloc 墠뢠 ࠭⢮  ࠭ -

           n ⮢,   size .   -
           0.

               頥 祭.

               㭪 calloc 頥  㪠⥫  char    墠祭
         ࠭⢮.
                 ,    㪠뢠 頥 祭, -
         ࠭஢ ࠢ  ࠭  ⨯ ꥪ.  ⮡
           㪠⥫  ⨯, ⫨  char, ᯮ ८-
         ࠧ⥫ ⨯ 頥 祭.
               頥 祭 NULL, ᫨ ⠫ 筮  -
         .
               .⠪ free, haloc, hfree, malloc, realloc.

               ਬ:

            #include <malloc.h>

            long *lalloc;
                 .
                 .
                 .
         /*  墠뢠 筮 ⢮   40 
         楫  樠   0 */

            lalloc=(long*)calloc(40, sizeof(long));


               CEIL

            #include <math.h>

            double ceil(x);
            double x;        祭  饩 窮

               ᠭ.

               㭪 ceil 頥 祭 double, ।⠢饥 -
         襥 楫, ஥   ࠢ x.

               頥 祭.

               㭪 ceil  頥  double  १.  頥
         祭  砥 訡 .

               .⠪ floor, fmod.


               ਬ:

            #include <math.h>

            double y;
            .

            .
            .
            y = ceil(1.05);    /* y = 2.0 */
            y = ceil(-1.05);   /* y = -1.0 */


               CGETS

            #include <conio.h>   ॡ ⮫쪮    
                                 㭪樨


            char *cgets(str);
            char *str;             ࠭ 

            ᠭ.

               㭪  cgets ⠥ ப ᨬ אַ  ᮫  -
          ப     ⮯, 㪠  str.  Str
           㪠⥫  ᨢ ᨬ.   ᨢ
         -  str[0]  ᮤঠ ᨬ  ( ᨬ) ⠥-
          ப. ᨢ   筮 訬,  ⮡  ᮤ-
           ப, ᨬ 砭 '\0'    ⥫  .
         㭪  cgets த 뢠 ᨬ,   㤥 -
         ⠭    "-"   । ⢮  ᨬ.
         ப  ,  稭  str[2]. ᫨   "-"
         ⠭, ।        㫥 ᨬ
         '\0'.
               㭪  cgets  ஬  ᨢ str[1] 
         ⢨⥫  ப.

               頥 祭.

               㭪 cgets 頥 㪠⥫  砫 ப, 
         室  str[2]. 頥 祭  砥 訡 .
               .⠪ getch, getche.

               ਬ:

            #include <conio.h>

            char *result;
            int numread;
            .
            .
            .
            *buffer=80; / *ᨬ쭮 ⢮ ᨬ */

            /* . *buffer ⭮ *buffer[0] */

               /* ᫥騥   ப    室
          : */

                result=cgets(buffer);
                numread=buffer[1];


               /* result 㪠뢠  ப, numread -     (""
          ⠥, ..  㫥 ᨬ */.

               CHDIR

            #include <direct.h>  ॡ  ⮫쪮   
                                 㭪樨

            int chdir(pathname);
            char *pathname;      path-    ࠡ祣 ४-
                                 

               ᠭ.

               㭪 chdir  ⥪騩 ࠡ稩 ४਩  ४-
         ਩, ।塞  pathname; pathname  뫠  -
         騩 ४਩.

               頥 祭.

               㭪  chdir 頥 祭 0, ᫨ ࠡ稩 ४-
         ਩ ᯥ譮 . 頥 祭 -1 㪠뢠   訡-
         ;    ⮬ 砥 errno ⠭  ENOENT, 㪠뢠, 
          path-    . 訡  , -
          pathname । ⥪騩 ࠡ稩 ४਩.
               .⠪ mkdir, rmdir, system.

               ਬ:

            #include <direct.h>

            /* ᫥騩   ⥪騩 ࠡ稩
            ** ४਩  ४਩    */

            chdir("/"); /* 砭: ⭮ chdir("\\") */



               CHMOD

            #include <sys\types.h>
            #include <sys\stat.h>
            #include <io.h>       ॡ ⮫쪮  
                                  㭪樨

            int chmod(pathname,pmode);
            char *pathname;       path- 饣 䠩
            int pmode;            ࠧ襭   䠩

               ᠭ.

               㭪 chmod  ࠧ襭   䠩, -
          path-. 襭  ࠢ ⥭   
         䠩. ⠭⭮ ࠦ pmode ⮨     -

          ⠭ S_IWRITE  S_IREAD, ।  <sys\stat.h>.
           㣮  祭   pmode .   
         ⠭,  ꥤ ᪨ ஬  (:). -
          㬥⮢ pmode ।⠢ .


                                   

            S_IWRITE                     ࠧ襭 

            S_IREAD                      ࠧ襭 ⥭

            S_IREAD : S_IWRITE           ࠧ襭 ⥭  

               ᫨ ࠧ襭    , 䠩  㯥  ⮫쪮
           ⥭.   MS DOS  䠩 㯭  ⥭, ⮬ -
           ࠧ襭  ⮫쪮    .  ⮬  ०
         S_IWRITE  S_IREAD : S_IWRITE  묨.

               頥 祭.

               㭪  chmod 頥 祭 0, ᫨ ࠧ襭 -
          ᯥ譮 . 頥 祭 -1 ᢨ⥫  
         訡;    ⮬ 砥 errno ⠭  ENOENT, 㪠뢠,
          । 䠩    .
               .⠪ access, creat, fstat, open, stat.


               ਬ:

            #include <sys\types.h>
            #include <sys.stat.h>
            #include <io.h>
            int result;
            .
            .
            .
            result=chmode("data",S_IREAD);
               /* ᮧ 䠩 ⮫쪮  ⥭ */
            if (result==-1)
               perror("can't change file mode");



               CHSIZE

            #include <io.h>      ॡ  ⮫쪮   
                                 㭪樨

            int chsize(handle,size);
            int handle;          handle-, 뫠騩  
                                 䠩
            long size;             䠩  

               ᠭ.


               㭪  chsize 㢥稢  㬥蠥 䠩, 易 
         handle-஬,  ࠧ, ।塞 㬥⮬ size.   -
                 ०,  ࠧ蠥 . ᫨ 䠩
         㢥稢,    㫥 ᨬ '\0'. ᫨ 䠩
         㬥蠥,       㪮祭 䠩  ࢮ-
         砫쭮  䠩 .

               頥 祭.

               㭪 chsize 頥 祭 0, ᫨ 䠩 ᯥ譮 -
         .  頥  祭  -1  ᢨ⥫   訡  
         errno ⠭    ᫥ 祭:

                          

            EACCES           䠩  ।  ⮫쪮   
                           ⥭.  ᨩ MS DOS 3.0  ,
                           EACCES ᢨ⥫  ਭ㤨⥫쭮
                           ஢.(। 䠩  -
                           ஢  㯠)

            EBADF           䠩 handle

            ENOSPC           ன⢥   ⠫  ᢮
                           

               .⠪ close, creat, open.

               ਬ:

            #include <io.h>
            #include <fcntl.h>
            #include <sys\types.h>
            #include <sys\stat.h>

            #define MAXSIZE 32768L

            int fh, result;
            .
            .
            .
            fh=open("data", O_RDWR|O_CREAT, S_IREAD|S_IWRITE);

            .
            .
            .
            /* । ⨥ 䠩 㦭 㡥,  
            **   32
            */
            if (lseek(fh,LO,2)>MAXSIZE)
               result=chsize(fh,MAXSIZE);


               _CLEAR87


            #include <float.h>

            unsigned int _clear87();  砥    頥 ᫮
                                        饩 窨

               ᠭ.

               㭪 _clear87 砥  ࠥ ᫮  饩
         窨.   饩 窨   樥  ᫮
           8087/80287  㣨 ﭨ, 㦨 8087/80287
         handler-, ⠪  ९   稬 ⥪ -
         饩 窨.

               頥 祭.

                 頥 祭      饩
         窨.    include-䠩 <float.h>   ᠭ -
         ⮢, 頥 㭪樥 _clear87.
               砭. 設⢮  ⥬᪨  㭪-
         権  ᫮  8087/80287   ।᪠㥬  -
         ⮬.  頥  祭  㭪権  _clear87  _status87
         ⠭  ⮢묨 ᫥ 믮 ᪮쪨  -
         権    饩  窮   묨 ﭨﬨ ᫮ 
         饩 窨.
               .⠪ _control87, _status87.

               ਬ:

            #include <stdio.h>
            #include<float.h>

            double a = 1e-40,b;
            float x,y;

            main()
              {
              printf("status=%.4x - clear\n",_clear87());
              y = a;

               /*   y     ﭭ  -
          */
              printf("status=%.4xx - inexact, underflow\n",
                     _clear87());
              b = y;    /* y  ࠢ */
              printf("status=%.4x - denormal\n", _clear87());
              }


               CLEARERR

            #include <stdio.h>
            void clearerr(stream);

            FILE  *stream;          㪠⥫   FILE


               ᠭ.

               㭪  clearerr ⠭  ⮪ stream -
          訡    䠩 (EOF)  0.  訡
         ⮬᪨  ; ᫨  ⮪ ⠭  
         訡,   樨  ⮪   祭 訡
           ,  㭪樨 clearerr  rewind   맢.
               . ⠪ 㭪樨 eof, feof, ferror, perror.

               ਬ:

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

            FILE *stream;
            int c;

               /* ᫥騥     ⮪  ஢,
            訡  ⥭. ।  ⥭  ⮪  
          ।⥫쭮  */.
            if ((c=getc(stream))==EOF)
            {  if (ferror(stream))
               {  fprintf(stderr, "write error\n");
                  clearerr(stream);
               }
            }


            CLOSE

            #include <io.h>     ॡ  ⮫쪮    
                                㭪樨.
            int close(handle);
            int handle;         handle-,  뫠騩  
                                䠩.

               ᠭ.

               㭪   close  뢠    䠩,  樨஢  
         handle.

               頥 祭.

                㭪 頥 0, ᫨ 䠩 ᯥ譮 . -
         頥 祭 -1 ᢨ⥫  訡; 㭪 errno -
           EBADF,  ᢨ⥫  ࠢ쭮 㬥
         handle- 䠩.
               . ⠪ chsize, creat, dup, dup2, open, unlink.

               ਬ:

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


            int fh;

            fh = open("data", O_RDONLY);
            .
            .
            .
            close(fh);.


               _CONTROL87

            #include <float.h>

            unsigned int _control87(new,mask); 砥 ᫮ -
                                               ࠢ 饩
                                               窨

            unsigned int new;                      祭
                                               ⮢       ᫮
                                               ࠢ

            unsigned int mask;                 ⠭
                                               ᪠    
                                               ⮢ ᫮ ࠢ-
                                               

               ᠭ.

               㭪 _control87 砥  ⠭ ᫮  ࠢ-
           饩  窨.  ࠢ 饩 窨 
           ணࠬ ० 筮, 㣫   ᪮筮
           ⥬᪮  ணࠬ  饩 窮. ᪫-
         ⥫ ﭨ  饩 窮 ⠪  ᪨஢  
         ࠧ᪨஢, ᯮ  ⮣ 㭪 _control87.
               ᫨  祭   mask ࠢ 0, ⮣ _control87 砥
         ᫮ ࠢ  饩 窮. ᫨ mask  㫥,  -
             祭  ᫮ ࠢ ᫥騬 -
         :    ࠢ 1  mask ᮮ⢥騩     new
         ᯮ   ᫮ ࠢ ᫮.  -
          ⠪:

                fpcntrl=((fpcntrl & ~mask) : (new & mask)),

          fpcntrl  ᫮ ࠢ  饩 窮.

                頥 祭.

                  頥 祭  ﭨ ࠢ-
           饩 窮. . include-䠩  <float.h>    
         ᠭ ⮢, 頥 _control87.
               .⠪ _clear87, _status87.



               ਬ:

            #include <stdio.h>
            #include<float.h>

            double a = .1;

            main()
               {
               /* 砥 ᫮ ࠢ */
               printf("control=%.4x\n", _control87(0,0));
               printf("a*a=.01=%.15e\n",a*a);

               /* ⠭ 筮  24  */
               _control87(PC_24, MCW_PC);
               printf("a*a=.01(rounded to 24 bits)=%.15e\n",a*a);

               /* ⠭  ࢮ砫쭮 㬮砭 */
               _control87(CW_DEFAULT, 0xffff);
               printf("a*a=.01=%.15e\n",a*a);
               }


               COS-COSH

            #include <math.h>

            double cos(x);       ᨭ x
            double cosh(x);      ࡮᪨ ᨭ
                                x
            double x;           ࠤ

               ᠭ.

               㭪樨  cos  cosh  ᮮ⢥⢥ ᨭ  -
         ࡮᪨ ᨭ x.

               頥 祭.

               㭪 cos 頥 ᨭ x. ᫨ x 让,  १-
            筠  稬.  ⮬  砥
         cos  ࠡ뢠  訡 PLOSS,  ᮮ饭  ⠥. ᫨ x
         ⮫쪮 让,    稬  १,  
         cos ⠥ ᮮ饭  訡 TLOSS  stderr  頥 0. 
           errno ⠭  ERANGE.
               㭪 cosh 頥 ࡮᪨ ᨭ x. ᫨ -
           让,  cosh  頥 祭 HUGE  ⠭
         errno  ERANGE.
               aa 訡      ஢aa    ᯮ-
         a 楤 matherr.
               .⠪  acos, asin, atan, atan2, matherr, sin, sinh, tan,
         tanh.

               ਬ:

            #include <math.h>


            double x,y;
            .
            .
            .

            y = cos(x);
            y = cosh(x);


               CPRINTF

           #include <conio.h>      ॡ ⮫쪮  
                                   㭪樨
           int cprintf(format-string[,argument...]);
           char *format-string;   ப ࠢ ଠ⮬

               ᠭ.

               㭪 cprints ଠ  ⠥ ࠧ ᨬ  
         祭 אַ  ᮫, ᯮ  뢮 ᨬ 㭪-
           putch.    arguments (᫨  ) ८ࠧ뢠 
         뢮  ᮣ᭮  ᮮ⢥饩   ᯥ䨪樨   ଠ   
         format-string.  Format-string     ᠬ   㭪,
           㬥 format-string  㭪樨 printf (.ᠭ -
         樨 printf  祭 ஡ ଠ樨  format-string  
         㬥).

               頥 祭.

               㭪 cprintf 頥 ᫮ ⠭ ᨬ.
               .⠪ fprintf, printf, sprintf, vprintf.
               砭!   ⫨稨  㭪権 sprintf, printf  sprintf,
         㭪 cprintf  室  ࠭᫨ ᨬ    
         "-".

               ਬ:

            #include <conio.h>

            int i=-16, j=29;
            unsigned int k=511;

           /* ᫥騩  ⠥ i = -16, j = 0x1d, k = 511 */
            cprintf("i=%d, j=%#x, k=%u\n", i,j,k);


               CPUTS

            #include <conio.h>     ॡ ⮫쪮  
                                   㭪樨

            void cputs(str);
            char *str;             㪠⥫  뢮 ப


               ᠭ.

               㭪  cputs  뢠  ப,  稢 㫥
         ᨬ    㪠뢠 str, אַ  ᮫.
               砭.  ப  " ⪨  -  ॢ
         ப" ᫥  ⮬᪨  .

               頥 祭.

               頥 祭 .

               .⠪ putch.

               ਬ:

            #include <conio.h>

            char *buffer = "Insert data disk in drive a: \r\n";

            /* ᫥騩  뢮 ᪠  ᮫ */.

            cputs(buffer);.

               CREAT

            #include <sys\types.h>
            #include <sys\stat.h>
            #include <io.h>       ॡ ⮫쪮  
                                  㭪権.

            int creat(pathname, pmode);
            char *pathname;       path-  䠩
            int pmode;            ࠧ襭 ० 㯠

               ᠭ.

               㭪 creat  ᮧ  䠩,  뢠  -
           (ᥪ    0) 騩 䠩. ᫨ 
         䠩, ।塞 path-,  ᮧ  䠩   -
           ०  㯠  騩   . ᫨ 䠩
            ० 㯠   ,  ⮣  㭪
         creat  ᥪ 䠩   0, 㭨⮦  ᮤন,  -
         ६ 뢠 䠩.
               襭 ० 㯠 - pmode - ਬ ⮫쪮  
           ᮧ  䠩.  䠩 砥 ⠭ ०
         㯠 ᫥ ࢮ  .  ࠦ pmode ⮨
               ᪮쪨    ⠭  -  S_IWRITE  
         S_IREAD,     <sys\stat.h>. ᫨   ⠭,
          ꥤ   ᪮ OR (:). 祭 㬥-
          pmode ਢ .

                            

            S_IWRITE               ࠧ蠥 

            S_IREAD                ࠧ蠥 ⥭


            S_IREAD:S_IWRITE       ࠧ ⥭  

               ᫨   ࠧ襭, 䠩 ।祭 ⮫쪮  -
         .  MS DOS   ࠧ  ⮫쪮  .  ⮬  ०
         S_IWRITE  S_IREAD: S_IWRITE  묨.
                 MS DOS 3.0   䠩, 뢠  -
           creat, ᥣ 뢠  ᮢ饭 ० (compatibility
         mode).
               㭪 creat । ⠭  䫠  㯠  ᢠ
         pmode ᪥ 㯠 (஡  ⮬ ᬮ umask).

               頥 祭.

                 砥 ᯥ譮 맮  㭪 頥 handle 
         ᮧ 䠩. 頥 祭 -1 ᢨ⥫  訡-
         ; errno ⠭    ᫥ 祭:


                            
            

            EACCES           Path-   ।    騩
                             䠩   ⮫쪮       ⥭     
                             । ४਩  䠩

            EMFILE           㣨  handle-  䠩  ਣ,
                             ..   䠩

            ENOENT           path-  .

               . ⠪ chmod, chsize, close,  dup,  dup2,  open,  sopen,
         umask.
               砭.  楤  create  ᯥ稢  ࢮ砫
         ᮢ⨬  ।騬 ⥪. 맮 open    
         祭 O_CREAT  O_TRUNC, ।  㬥 oflag, -
            ।⥫   .

               ਬ:

            #include <sys\types.h>
            #include <sys\stat.h>
            #include <io.h>
            #include <stdlib.h>

            int fh;

            fh = creat("data", S_IREAD|S_IWRITE);

            if (fh == -1)
                perror("Couldn't create data file");.



               CSCANF

            #include <conio.h>     ॡ ⮫쪮  
                                   㭪樨

            int cscanf(format-string[,argument...]);
            char *format-string;   ப ࠢ ଠ⮬

               ᠭ.

               㭪 cscanf ⠥  אַ  ᮫  , -
           arguments  (᫨  ), ᯮ  ⥭ ᨬ
         㭪 getch.  㬥 argument   㪠⥫ 
         ६  ⨯,  ᮮ⢥  ।  ⨯  
         format-string. Format-string ࠢ 樥  
               ᠬ   㭪,  㬥 format-string
          㭪樨 scanf (. ᠭ 㭪樨 scanf  祭  -
         ஡ ଠ樨  format-string).

               頥 祭.

               㭪  scanf  頥  ᫮ ᯥ譮 ८ࠧ 
         祭 . 頥 祭  ᮤন ⠭,
           祭 .  ⪥ ⥭  䠩 -
          祭 EOF. 頥 祭 0 砥,    -
         祭  .
               .⠪ fscanf, scanf, sscanf.

               ਬ:

            #include <conio.h>

            int result;
            char buffer [20];
            .
            .
            .
            cprintf("Please enter file name: ");

         /*  ᫥騩        
         ப */

            result = csanf("%19s", buffer);

         /* result - ᫮ ୮  .  ࠢ  0,  ᫨
          ᮮ⢥⢨ */


               CTIME

            #include <time.h>   ॡ ⮫쪮  
                                㭪樨
            char *ctime(time);
            long *time;         㪠⥫  ࠭ ६


               ᠭ.

               㭪  ctime ८ࠧ ६, ࠭  long- -
         ,  ᨬ ப. 祭 time 筮 砥   -
          㭪樨 time,  頥 ⢮ ᥪ㭤, ன-
           祭 ६  ਭ, ..  1 ﭢ 1980 .
               ப  १, ࠡ⠭  ctime, ᮤন 26 ᨬ-
            , ਢ   ਬ:

               Mon Jan 02 02:03:55 1980\n\0

               ᯮ 24 .       ﭭ  ਭ.
            ப ('\n')  㫥 ᨬ ('\0')   
         ᫥ 樨  ப.
                MS DOS  ࠭ 1980     .  ᫨  time
         ।⠢  । 1 ﭢ 1980 , ctime 頥 ᨬ-
          ப, ।⠢ 00:00:00 January 1,1980.

               頥 祭.

               㭪 ctime 頥 㪠⥫  ᨬ ப -
         . 頥 祭  砥 訡 .
               .⠪ asctime, ftime, gmtime, localtime, time.

               砭. 㭪樨 asctime  ctime ᯮ    
         ᪨ 墠祭   ࠭   ப १-
         .    맮     楤 㭨⮦ १
         ।饣 맮.

               ਬ:

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

            long time;

            time(&ltime);
            printf("the time is %s\n",ctime(&ltime));


               DIIEEETOMSBIN-DMSBINTOIEEE


            #include <math.h>

            int dieeetomsbin(src8,dst8); ८ࠧ ᫮ 
                                         筮 ଠ  IEEE  
                                         筮  ଠ-
                                          MS

            int dmsbintoieee(src8,dst8); ८ࠧ ᫮ 
                                         筮   ଠ  MS 
                                           ଠ IEEE

               ᠭ.

               楤 dieeetomsbin ८ࠧ ᫮  筮 

         ଠ IEEE  筮 ଠ Microsoft.
               楤 dmsbintoieee ८ࠧ ᫮  筮 
         筮 ଠ Microsoft  IEEE ଠ.
                楤  ணࠬ ,    뢠
         ᫠    饩 窮  ଠ IEEE, ᯮ짮 ᫥
             砩 㯠,  ᮧ    
         Microsoft  BASIC,    뢠 ᫠  饩 窮 
          ଠ Microsoft  .
               㬥  src8      㪠⥫      ८ࠧ㥬
         double-祭.   뢠  ᯮ, 
         㬥⮬ dst8.

               頥 祭.

                㭪樨  0, ᫨ ८ࠧ  뫮  ᯥ-
         ,  1 - ᫨ ८ࠧ  ९.
               .⠪ fieeetomsbin, fmsbintoieee.

               砭.   楤  ࠡ뢠 IEEE NAN  ᪮-
         筮.  IEEE ࠪ  ८ࠧ  0.


               DIFFTIME


            #include <time.h>   ॡ  ⮫쪮    
                                㭪樨

            double difftime(time2,time1);
            time_t time2;       ⨯ time_t,   <time.h>


               ᠭ.

               㭪 difftime  ࠧ  time2  time1.


               頥 祭.

               㭪 difftime 頥 ன ६  ᥪ㭤  
         time1  time2  ᫮   筮.
               .⠪ time.


               ਬ:

            #include <time.h>

            int mark[10000];

            main()
                {
               /*   - ਬ 㯮ॡ ६ ।⢮ ᯮ짮-
          difftime.  , ᪮쪮 ६   ॡ,
         ⮡   ᫠  3  10000.  뢮 ⮣ -

           㭨⮦  ᠬ  譨 横  ਨ ࠭⥫
          "printf("%d\t",n);"*/

                time_t start, finish;
                register int i, loop, n, num, step;

                time(&start);
                for(loop=0; loop<1000; ++loop)
                   for(num=0,n=3;n<10000;n+=2)
                      if(!mark[n]) {
                          /* printf("%d\t",n); */
                          step=2*n;
                          for(i=3*n;i<10000;i+=step)
                                mark[i]=-1;
                          ++num;
                          }
                time(&finish);

                /*   "sieve" 砥  । 1000 横 */


                printf("\nProgram takes %f seconds to find %d
                       primes.\n",
                       difftime(finish,start)/1000,num);
                }

                室:

            Program takes 0.482000 seconds to find 1228 primes.


               DOSEXTERR


            #include <dos.h>

            int dosexterr(buffer);
            struct DOSERROR *buffer;

               ᠭ.

               㭪 dosexterr 砥 祭 ॣ, 頥
         ⥬ 맮 MS DOS 59H,  뢠  祭   -
         ,      㪠뢠  buffer.  㭪 , 
         ⥬ 맮 ࠡ뢠   MS DOS 3.0    
          । ७ ࠡ 訡.    ஡
         ⥬  맮  MS DOS ᠭ  㪮⢥ "Microsoft MS DOS
         Programmer's Reference Manual".
                 DOSERROR    <dos.h>    ।⠢
         ᫥饥:

            struct DOSERROR {
                   int exterror;
                   char class;
                   char action;

                   char locus;
                   };

               㬥  NULL-㪠⥫ ।⢮ dosexterr । 
         AX 頥 祭.

               頥 祭.

               㭪 dosexterr 頥 祭  ॣ  AX  (-
         筮   祭    exterror).
               .⠪ perror.

               ਬ:

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

            struct DOSERROR doserror;
            int fd;

            if ((fd=open("test.dat",O_RDONLY))==-1 {
               dosexterr(&doserror);
               printf("error=%d,class=%d,action=%d,locus=%d\n",
                       doserror.exterror, doserror.class,
                       doserror.action, doserror.locus);
               }


               DUP - DUP2

            #include <io.h>      ॡ  ⮫쪮   
                                 㭪権

            int dup(handle);     ᮧ   ன   handle-   
                                 ⮣ 䠩
            int handle;          handle-, 뫠騩  
                                 䠩

            int dup2(handle1, handle2);
                                  handle1   뫪  
                                 handle2 䠩

            int handle1;         handle-, 뫠騩  
                                 䠩
            int handle2;          祭 handle

               ᠭ.

               㭪樨  dup  dup2 뢠 ன handle- 䠩, 易-
              䠩.  樨    䠩    뫠
         handle-஬, ⮣   handle-, 易   䠩,
         ᯮ   ᠬ 㪠⥫  䠩.   handle
            ⨯ 㯠 䠩.
               㭪 dup 頥 ᫥騩 㯭 handle-  -

           䠩.  㭪  dup2  (force)  handle,
         .. handle2, ⮡ ᫠    ᠬ  䠩,    
         뫠 handle1. ᫨  ६ 맮 handle2 易  
         䠩,   䠩 뢠.

               頥 祭.

               㭪  dup  頥  handle- 䠩. 㭪 dup2
         頥 0  砥 ᯥ. ᫨  訡,   㭪樨
           -1  errno ⠭    ᫥ -
         .

                               

            EBADF                handle- 䠩

            EMFILE              㣨   handle- 䠩   
                                 㯭, ..    
                                䠩

               . ⠪ close, creat, open.


               ਬ:

            #include <io.h>
            #include <stdlib.h>

            int fh;
            .
            .
            .
               /* 롨ࠥ 㣮 handle- 䠩, ⮡ ᫠    
          ᠬ 䠩,   㪠뢠 handle1 (stdout) */

            fh = dup(1);

            if (fh == -1)
               perror("dup(1) failure");

               /*  ᮧ  handle3 䠩  뫪    ᠬ 䠩,
           뫠 handle 1 (stdout). ᫨ handle3 䠩  -
          ⠪ ,  뢠  */

            fh = dup2(1,3);

            if (fh != 0)
               perror("dup2(1,3) failure");.


               ECVT


               #include <stdlib.h>      ॡ    ⮫쪮    
                                         㭪樨

               char *ecvt(value, ndigits, decptr,signptr);

               double value;            ८ࠧ㥬 ᫮

               int ndigits;             ⢮    
                                        

               int *decptr;             㪠⥫    
                                         筮 窨

               int *signptr;            㪠⥫    
                                          


               ᠭ.
               㭪  ecvt  ८ࠧ뢠  ᫮   饩 窮 
         ᨬ ப. Value -  ᫮  饩 窮,  ஥
           ८ࠧ. Ecvt   ndigits  value
          ப     㫥 ᨬ ('\0'). ᫨ ⢮
           value ॢ蠥 ndigits, ᫥   㣫-
         . ᫨  , 祬 ndigits, ப  ﬨ.
                 ப ࠭ ⮫쪮 .  筮 窨
            value   ।  ᫥  맮  㭪樨  
         decptr  signptr. 㬥 decptr 㪠뢠  楫 ᫮, -
         饥  筮 窨 ⭮⥫쭮 砫 ப. 0
           ⥫쭮 祭 ,  筠 窠 ᯮ-
           ࢮ . 㬥 signptr 㪠뢠    楫,
         ।饥    ८ࠧ㥬  ᫠.  ᫨ signptr ࠢ 0,
         ᫮ ⥫쭮,  - ⥫쭮.


               頥 祭.

               㭪 ecvt 頥 㪠⥫  ப .   砥
         訡 頥 祭 .
               .⠪ atof, atoi, atol, fcvt, gcvt.

               砭.  㭪樨 ecvt  fcvt ᯮ  ८ࠧ-
              ᪨ । .  -
              楤 㭨⮦ १ ।饣 -
         饭.


               ਬ:

               #include <stdlib.h>

               int decimal, sign;
               char *buffer;
               int preciision=10;


               buffer=ecvt(3.1415926535,precision,&decimal,&sign);
                  /* ᮤন "3141592654",decimal=1,sign=0*/



               EOF

            #include <io.h>      ॡ ⮫쪮    
                                 㭪樨

            int eof(handle);
            int handle;          handle-, 뫠騩  
                                 䠩

               ᠭ.

               㭪 eof । ⨦   䠩    䠩,
         樨஢  handle.

               頥 祭.

                㭪 頥 祭 1, ᫨ ⥪  -
           殬 䠩; 0 -  ⨢ 砥. 頥 -
          -1 ᢨ⥫  訡; errno ⠭   EBADF,
         樨  ⮬  handle 䠩.
               . ⠪ clearerr, feof, ferror, perror.

               ਬ:

            #include <io.h>
            #include <fgntl.h>

            int fh, count;
            char buf[10];

            fh = open("data", O_RDONLY);

               /* ᫥騩  ஢ । ⥭ ᫮ 
         䠩 */

            while (!eof(fh))
            { count = read(fh, buf, 10);
              .
              .
              .
              }.


               EXECL - EXECVPE


            #include  <process.h>       ॡ    ⮫쪮    
                                         㭪権

            int execl(pathname, arg0, arg1 ... ,argn, NULL);

            int execle(pathname, arg0, arg1 ... ,argn, NULL, envp);

            int execlp(pathname, arg0, arg1 ... ,argn, NULL);


            int execlpe(pathname, arg0, arg1 ... ,argn, NULL, envp);

            int execv(pathname, argv);

            int execve(pathname, argv, envp);

            int execvp(pathname, argv);

            int exevpe(pathname, argv, envp);

            char *pathname;                 path-  믮塞
                                            䠩
            char *arg0, *arg1, ..., *argn;  ᯨ᮪  㪠⥫  
                                            㬥
            char *argv[];                   ᨢ  㪠⥫  
                                            㬥
            char *envp[];                   ᨢ  㪠⥫  
                                            ⠭  㦥-
                                            
               ᠭ.

               㭪樨  exec  㦠    믮  child-.
          맮 ந襫 ᯥ譮, child- ࠧ頥   -
         ,  ⮩  맢訬  ᮬ.    㧪    믮
         child-   㯭 筮 .
               Pathname  ।   path  (  ),  
         path ( ⥪饣 ࠡ祣 ४)    䠩.
               ᫨ pathname   ७   䠩   ᫨
           稢 窮 (.), ⮣ 㭪樨 exec ⠭
         ७  .EXE. ᫨ pathname  ७,  ᯮ
         ⮫쪮  ७. ᫨ pathname 稢  窮,  exec
         ⢫    pathname    ७. 楤 execlp,
         execlpe, execvpe ⢫   pathname (ᯮ  
         ᠬ 楤)  ४, । ६
         㦥 PATH.
               㬥    ।    㬥  
         맮 exec ⥬     㪠⥫  ᨬ-
           ப.  ᨬ ப ࠧ ᯨ᮪ 㬥⮢ 
         child-.   ப, । ᯨ᮪ 㬥⮢
           ,   ॢ 128 ⮢. 㫥  ᨬ-
          砭 '\0 '   ப     뢠-
         , ᨬ ஡ (⮬᪨ ⠢塞  㬥⮢) -
         뢠.
               ⥫ 㬥⮢  ।  ⤥ -
           ( execl, execle, execlp, execlpe)   ᨢ 㪠-
          ( execv, execve, execvp, execvpe).  ࠩ    -
         㬥  -  arg0  argv[0] -   । child-.
          ᮣ襭  㬥    㬥  pathname.
         (㣮  祭    㤥 ਭ  訡).   MS
         DOS, ࠭  3.0, । 祭 arg0  argv[0]  -
           㯭  ᯮ짮  child-. , 
         ᨩ  MS  DOS  3.0       pathname 㯭  arg0 
         argv[0].
               맮 execl, execle, execlp, execlpe  筮  ᯮ

         ⮣,    ⢮  㬥⮢  ⭮ ࠭. 㬥
         arg0 筮  㪠⥫  pathname. 㬥  arg1 
         argn 㪠뢠  ᨬ ப, ࠧ騥  ᯨ᮪  -
         㬥⮢. 騩  㬥⮬ argn NULL-㪠⥫ । -
          ᯨ᪠ 㬥⮢.
               筮  맮  execv, execve, execvp, execvpe ᯮ
         ⮣,  ᫮ 㬥⮢      -
         .  ⥫  㬥 뫠  ᨢ argv. -
         㬥 argv[0] 筮  㪠⥫  pathname.  㬥
           argv[1]  argv[n] 㪠뢠  ᨬ ப, ࠧ騥
          ᯨ᮪ 㬥⮢. 㬥 argv[n+1]   NULL-㪠-
         ⥫  ।  ᯨ᪠ 㬥⮢.
               ,   맮 exec,  묨    -
           .   맮 execl, execlp, execv, execvp child--
          ᫥ 㦥 parent-. 맮 execle, execlpe,
         execve, execvpe   짮⥫    㦥  
         child-,  ।  ᯨ᮪ ⠭ 㦥 १
         㬥 envp.
               㬥 envp  ᨢ 㪠⥫  char,  
           ண (᪫ ᫥ ) 㪠뢠  -
         ,  稢 㫥  ।  ६  㦥-
         . 筮  ப  :

               NAME = value   ,

           NAME -    ६  㦥,  value  - 祭 -
           (⨬,   value  砥  窨 "..."). ᫥-
          ⮬ ᨢ envp   NULL.
               ᫨ 祭 envp  NULL, child-  ᫥
         ⠭ 㦥 parent-.

               頥 祭.

               㭪樨  exec      ଠ쭮   뢠騩
         . ᫨  㭪樨 exec ந室 ,   砥
         訡  頥 祭 ࠢ  -1.  ६  errno  
         ⮬ ⠭    ᫥ 祭:


                            


            E2BIG          ᮪ 㬥⮢ ॢ蠥  128  ,
                               ࠭⢮,    ॡ㥬   
                           ଠ樨 㦥, ॢ蠥 32

            EACCES         ஢    ࠧ 䠩  (
                           ᨩ 3.0  )

            EMFILE            䠩 (ᯥ஢-
                            䠩     ,    ⮡
                             믮)

            ENOENT           path-  


            ENOEXEC         䠩     믮塞
                              ଠ

            ENOMEM         㯭       筮  
                           믮 child-;  㯭
                                  祭;   
                             , 㪠뢠騥,
                            parent- ୮ ࠧ饭

               .  ⠪  abort,  exit,  _exit,  onexit, spawnl, spawnle,
         spawnlp, spawnlpe, spawnv, spawnve, spawnvp, spawnvpe, system.
               砭. 맮 exec  ࠭ ⥪⮢ ०  ८-
         ࠧ    䠩. ᫨ child-  ᯮ-
          䠩, 㭠᫥    parent-,  ⮣  
           ᯮ짮 楤 setmode  ⠭ ॡ㥬 -
          ८ࠧ   䠩.
               ⠭ ᨣ 뢠  ࠭    child--
         ,  ᮧ 맮 楤 exec.  ⠭ -
           㬮砭  child-.

               ਬ:

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

            extern char **environ;

            char *args[4];
            int result;

            args[0] = "child";
            args[1] = "one";
            args[2] = "two";
            args[3] = NULL;

               /*    ᫥騥     믮 ,
          "child.exe",  ।   㬥. */


            result = execl("child.exe", "child", "one", "two",
                           NULL);
            result = execle("child.exe", "child", "one", "two",
                           NULL, environ);
            result = execlp("child.exe", "child", "one", "two",
                           NULL);
            result = execv("child.exe", args);
            result = execve("child.exe", args, environ);
            result = execvp("child.exe", args);.


               EXIT - _EXIT

            #include <process.h>   ॡ ⮫쪮  
                                   㭪樨
            #include <stdlib.h>    ᯮ    <process.h>,

                                    <stdlib.h>

            void exit(status);     蠥   ᫥ -
                                    䠩

            void _exit(status);    蠥    -
                                    ஢ ⮪
            int status;             室


               ᠭ.

               㭪樨 exit  _exit  맢 . । -
         襭   㭪 exit     뢠
           䠩. 㭪 _exit 蠥     -
          ஢ ⮪. 祭 status 筮 ⠭ 
         0   㪠 ଠ쭮 室  ⠭   -
          祭  ।  訡.  ᪮  맮  exit  
         _exit    祭, 訩  status  -
         ⮬  饣 parent-. ᫨    parent-,
          祭 status .

               頥 祭.

               頥 祭 .
               .⠪  abort,  execl,  execle,  execlp,  execv,  execve,
         execvp,  onexit,  spawnl,  spawnle,  spawnlp,  spawnv,   spawnve,
         spawnvp, system.

               ਬ:

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

            FILE *stream;
            .
            .
            .

               /*  ᫥騥   뢠 襭  ᫥
          ஢    䠩 */

            if((stream=fopen("data","r"))==NULL) {
                fprintf(stderr,"couldn't open data file\n");
                exit (1);
                }
               /* ᫥騥  뢠  襭 -
         , ᫨ 䠩     */

            if((stream=fopen("data","r"))==NULL)

                {

                fprintf(stderr,"couldn't open data file\n");
                _exit (1);

                }


               EXP


            #include <math.h>

            double exp(x);
            double x;          祭  饩 窮

               ᠭ.

               㭪 exp 頥 ᯮ樠 㭪 ᢮  -
         㬥 x  饩 窮.

               頥 祭.

               㭪 exp 頥 e  ⥯ x.  ९ -
           頥  HUGE  ⠭ errno  ERANGE,  
         稬 exp 頥 0,   ⠭ errno.
               .⠪ log.

               ਬ:

            #include <math.h>

            double x,y;
            .
            .
            .
            y = exp(x);.



               _EXPAND


            #include <malloc.h>    ॡ ⮫쪮  
                                   㭪樨

            char *_expand(ptr,size);
            char *ptr;             㪠⥫  ࠭  墠祭
                                    
            unsigned size;          ࠧ  


               ᠭ.

               㭪 _expand  ࠧ  ࠭  墠祭  
         ,       㧨   । 
         ⮯  heap.
               㬥 ptr 㪠뢠  砫 . 㬥 size -
           ࠧ   . ন   .
               㬥 ptr ⠪ 㪠뢠  ᢮騩   

         ,    譥 맢 calloc, _expand, halloc, malloc
          realloc,    㤥 ᢮.
               ᫨ ptr 㪠뢠  ᢮ ,     -
         ⠥ ᢮  ᫥ 맮 _expand.

               頥 祭.

               㭪  _expand 頥 char-㪠⥫  १墠祭-
           .  ⫨稨  realloc, _expand    ।-
               ࠧ.  砥,  㬥 ptr
          _expand  ⥬  ᠬ,    頥  祭,
         ᫨    筮, ⮡     ।-
         .
               頥 祭 NULL, ᫨    筮  
         ७ .  ⮬ 砥 ꥪ,   㪠뢠 ptr,
         㤥 ७ ⮫쪮, ᪮쪮   ᯮ.
                 ,    㪠뢠 頥 祭, -
         ࠭஢ ࠢ  ࠭  ⨯ ꥪ.
                ࠧ ꥪ   ஢७ 㭪樥 _msize.
               ⮡  㪠⥫, ⨯ ண ⫨祭  char, -
          ८ࠧ⥫ ⨯ 頥 祭.
               .⠪ calloc, free, halloc, malloc, _msize, realloc.


               ਬ:

            #include <stdio.h>
            #include <malloc.h>

            main()

              {
               long *oldptr;
               unsigned int newsize=64000;

               oldptr=(long*)malloc(10000*sizeof(long));
               printf("Size of memory block pointed to by
                      oldptr=%u\n", _msize(oldptr));

               if (_expand(oldptr,newsize)!= NULL)
                 printf("expand was able to increase block
                        to %u\n", _msize(oldptr));

               else
                printf("expand was able to increase block to
                       only %u\n", _msize(oldptr));
               }



               FABS

               #include <math.h>

               double fabs(x);
               double x;                    祭  饩 窮

               ᠭ:

               㭪 fabs 頥 ᮫⭮ 祭 ᢮ 㬥-
           饩 窮.

               頥 祭:

               㭪 fabs 頥 ᮫⭮ 祭 ᢮ 㬥-
         . 頥 祭  砥 訡 .
               .⠪ abs, cabs, labs.

               ਬ:

               #include <math.h>

               double x,y;
               .
               .
               .
               y = fabs(x);.


               FCLOSE-FCLOSEALL

               #include <stdio.h>
               int fclose(stream);          뢠  ⮪.
               FILE *stream;                㪠⥫   FILE.
               int fcloseall();             뢠   ⮪.

               ᠭ.

               㭪樨  fclose, fcloseall 뢠 ᮮ⢥⢥ ⮪ 
         ⮪. । ⨥  , 易  ⮪,  -
         .    ⨨ ⮪ , 墠祭 ⥬, ᢮-
         . , । 㭪樥 setbuf, ⮬᪨ 
         ᢮ .
               㭪 fclose 뢠    ⮪  stream.  㭪
         fcloseall  뢠     ⮪   ᪫祭 stdin,
         stdout, stderr, stdaux, stdprn.

               頥 祭.

               㭪 fclose 頥 0, ᫨ ⮪ 㤠筮 . -
          fcloseall 頥 饥 ᫮  ⮪.   砥
         訡  㭪樨  祭 EOF.
               . ⠪ 㭪樨 close, fdopen, fflush, fopen, freopen.


               ਬ:

               #include <stdio.h>
               FILE *stream;
               int numclosed;
               stream=fopen("data", "r");
               .
               .
               .
               /* ᫥騩  ஥ ⮪ */
               fclose (stream);
               /* ᫥騩  뢠  ⮪,  ᪫祭
               stdin, stdout, stderr, stdaux, stdprn */
               numclosed=fcloseall();


               FCVT

               #include <stdlib.h>          ॡ ⮫쪮   -
                                             㭪-
                                            樨.
               char fcvt (value, ndec, decptr, signptr);
               double value;                ८ࠧ㥬 ᫮.
               int ndec;                    ⢮  ᫥ -
                                             窨.
               int *decptr;                 㪠⥫   -
                                             筮 窨.
               int *signptr;                㪠⥫   -
                                             .

               ᠭ:

               㭪  fcvt  ८ࠧ  ᫮  饩 窮  ᨬ-
          ப. Value - ᫮  饩 窮,  ஥  㦭
         ८ࠧ.  㭪  fcvt       value  
         ப     㫥 ᨬ ('0\').
                㬥 ndec  ⢮   ᫥  -
         筮 窨.
               ᫨  ⢮  ᫥ 筮 窨  value ॢ-
         蠥 ndec, ᫮  㣫,          ଠ  F
         FORTRAN. ᫨  , 祬  ndec, ப  ﬨ.
                 ப ࠭ ⮫쪮 .  筮 窨 
          ᫠ value    祭  ᫥  맮  㭪樨  
         decptr    signptr.  㬥 decptr 㪠뢠  楫 祭,
         饥  筮 窨,   砫 ப. 0 
         ⥫쭮 楫 祭 ,  筠 窠 
          ᠬ ࢮ . 㬥  signptr  㪠뢠    楫
         祭, ।饥  value: ᫨ 楫 signptr ⠭
          0,  value - ⥫쭮, ᫨ 楫 signptr - 㫥, 
         value - ⥫쭮.

               頥 祭:

               㭪 fcvt 頥 㪠⥫  ப . -
          祭  砥 訡 .
               .⠪ atol, atof, atoi, ecvt, gcvt.


               砭!  㭪樨 ecvt  fcvt ᯮ  ८ࠧ-
              ᪨ । .  -
              楤 㭨⮦ १ ।饣 -
         饭.

               ਬ.

               #include <stdlib.h>
               int decimal, sign;
               char *buffer;
               int precision = 10;
               buffer = fcvt (3.1415926535, precision,&decimal,&sign);
               /*buffer ="31415926535", decimal=1, sign=0*/


                FDOPEN

               #include <stdio.h>
               FILE *fdopen (handle,type);
               int handle;                  Handle-, 뫠騩  -
                                             䠩.
               char type;                   襭 ⨯ 㯠.

               ᠭ:

               㭪 fdopen 뢠 ⮪ /뢮  䠩, -
         ஢  handle,    ᤥ 䠩,  
         ஢, ଠ஢  ਧ.   ஡
           ᠭ  ࠧ 4.7 "  뢮"  㪮-
         ⢠.  쭠 ப type । ⨯ 㯠  ॡ㥬
         䠩 ᫥騬 ࠧ:

                               

            "r"              ⥭.  ( 䠩  
                         ⢮).

            "w"           ⮩ 䠩  ; ᫨ 
                         䠩  ࠭  ⢮,   ᮤন
                         㭨⮦.

            "a"           䠩     ()  
                           䠩.    䠩 , ᫨
                          .

            "r+"            ६    ⥭  
                         .   ⢮.

            "w+"           ⮩  䠩  ⥭  .
                         ᫨     䠩   ,      
                         ᮦন 㭨⮦.

            "a+"            ⥭    .   
                         䠩  , ᫨  .


               砭! 㦭 ⥫쭮 ਬ  ०  "w",  "w+",
         ⠪     㭨⮦ 騥 䠩. ஢-
          type   ᮢ⨬  ० 㯠  sharing--
         ,   䠩  .  প ⮩ ᮢ⨬
         ⢥砥 짮⥫.
               ᫨ 䠩   ⨯ "a"  "a+",  樨  
         믮     䠩,   ᯮ짮 㭪権 fseek
          rewind   ६饭 䠩 㪠⥫; , -
         । 믮  権    ᥣ  頥  
           䠩.    ࠧ, 騥   ᬮ 
         १ᠭ묨.  ᯥ஢ ⨯ "r+", "w",  "a",  -
         ६ ᪠ ⥭  . (,  䠩 
          ). ⮬   ४祭 ⥭    -
         ,  㦭 ᯮ짮 㭪樨 fseek  rewind.  㭪樨
         fseek ( 室)   ᯥ஢ ⥪  -
         .
               ⥫쭮  祭, ਢ ,   -
            ᫥ ᨬ  ப type, ⮡ ᯥ-
         ஢ ० ८ࠧ ᨬ  ப.

                           祭

              t                ⥪⮢   (࠭᫨饬)
                         ०;  樨 "  ⪨
                         - ॢ   ப"   ८ࠧ뢠   
                         ⢥  ᨬ "ॢ  ப".
                         뢮  ᨬ "ॢ ப"  ८-
                         뢠   " ⪨  -
                         ॢ ப".

              b               筮   (࠭᫨饬)
                         ०; ।襤騥    ८ࠧ
                         .

               ᫨ t  b  ப type  ,  ० ८ࠧ-
          । ६ _fmode, ⠭  㬮砭.


               頥 祭.

               㭪  fdopen  頥  㪠⥫   ⮪. 
         砥 訡 祭 㪠⥫ ࠢ NULL.
               . ⠪ dup, dup2,  fclose,  fcloseall,  fopen,  freopen,
         open.

               ਬ:

               #include <stdio.h>
               #include <fcntl.h>
               FILE *stream;
               int fh;
               fh=open("data", O_RDONLY);
               /*  ᫥騩     易 ⮪  
         䠩 */

               stream = fdopen(fh, "r");.


               FEOF

               #include <stdio.h>
               int feof(stream);
               FILE *stream;                㪠⥫   FILE.

               ᠭ.

               㭪 feof ।, ⨣    -
         . ᫨  䠩 (EOF) ⨣,  樨 ⥭  -
            䠩   ⮪  㤥   맢-
          㭪 rewind.

               頥 祭.

               ᫨  ⥪    殬 䠩 (EOF), 㭪
         feof 頥 㫥 祭. ᫨ ⥪   -
          殬 䠩 - 頥 祭 0. 㭪 feof  訡
          頥.
               . ⠪ clearerr, eof, ferror, perror.

               砭! 㭪 feof ॠ  .

               ਬ:

               #include <stdio.h>
               char string[100];
               FILE *stream;
               /*  ᫥騥    ᯥ稢   ப,  
          EOF */
               while (!feof(stream))
               if (fscanf(stream, "%s", string))
               process (string);.


               FERROR

               #include <stdio.h>
               int ferror (stream);
               FILE *stream;                㪠⥫   FILE.


               ᠭ.

               㭪 ferror ஢ 訡 ⥭     
         ⮪.   訡  訡 stream ⠥
         ⠭    ,  ⮪  ஥  "ࠧ-
         " (rewound)      㤥 맢 㭪 clearerr.


               頥 祭.


                砥 㦥 訡  ⮪  㭪 ferror  -
         頥 㫥 祭. 頥 祭 0 ᢨ⥫-
           ⢨ 訡.
               . ⠪ clearerr, eof, ferror, perrpr.
                㭪 ॠ  .

               ਬ:

               #include <stdio.h>
               FILE *stream;
               char *string;
               .
               .
               .

               /*  ᫥騥      ⮪  ஢,
            訡  . ।      ⮪
            ।⥫쭮  */
               fprintf (stream, "%s\n", string);
               if (ferror(stream))
               { fprintf (stderr, "write error\n");
               clearerr (stream;
                                }

               FFLUSH


               #include <stdio.h>
               int fflush (stream);
               FILE *stream;                㪠⥫   FILE.

               ᠭ.

               ᫨  ⮪ stream   뢮,  ᮤন
         ,  易  ⮪ stream 㭪樨 fflush, 뢠
          ᮮ⢥騩 䠩. ᫨ ⮪   ,    㭪
         fflush  頥 ᮤন . ᫥ 맮 㭪樨 ⮪ -
         ⠥ .   ਧ  ⮪  ਬ  ⮩
         㭪樨  䥪⨢.

               頥 祭.

               㭪  fflush  頥 0, ᫨  ᯥ譮 .
           祭 頥,  ⮪        
             ⮫쪮  ⥭.  砥  訡
         頥 祭 EOF.
               . ⠪ fclose, fflushall, setbuf.

               砭!  ⮬᪨ ,   -
         ,  ⮪ 뢠   ந諮  ଠ쭮  砭
         ࠡ ணࠬ   ⮪.

               ਬ:

               #include <srtio.h>

               FILE *stream;
               char buffer[BUFSIZ];
               .
               .
               .
               /*  ᫥騥      ⮪  -
             ⮪ */
               fflush (stream);
               setbuf (stream, buffer);.


               _FFREE

               #include <malloc.h>          ॡ ⮫쪮   -
                                              㭪樨.
               void _ffree(ptr);
               char far *ptr;               㪠⥫  墠祭 
                                            .

               ᠭ.

               㭪  _ffree  ᢮     㬠稢
         ᥣ . 㬥 ptr 㪠뢠  ࠭ 墠祭 
          ।⢮ 맮 㭪樨 _fmalloc.
               ᫮ ᢮ ⮢  ᫮ ⮢, ।-
           墠 (ࠧ饭) . ᫥ 맮 ᢮訩-
            ਣ  墠.

               頥 祭.

               頥 祭 .
               .⠪ _fmalloc, free, maloc.

               砭! ⪠ ᢮   ptr  (㪠⥫  
         墠뢠 ।⢮ _fmalloc)  ਢ  ᫥饬
         墠  맢 訡.

               ਬ:

               #include <malloc.h>
               #include <stdio.h>
               char far *alloc;
               /* 墠뢠 100 ⮢  ⥬ ᢮  */
               if ((alloc=_fmalloc(100))==NULL)
               /* ஢  ࠢ쭮 㪠⥫ */
               printf("unable to allocate memory\n");
               else   {
               .
               .
               .
               _ffree(alloc);
               /* ᢮   heap */
               }



               FGETC-FGETCHAR


               #include <stdio.h>
               int fgetc (stream);          ⠥ ᨬ  ⮪.
               FILE *stream                 㪠⥫   FILE.
               int fgetchar();              ⠥ ᨬ  stdin.

               ᠭ.

               㭪  fgetc  ⠥ ⤥ ⥪騩 ᨬ  室
         ⮪ stream  㢥稢 ᮮ⢥騩  㪠⥫  (᫨  
         )    㪠  ᫥饣  뢠  ᨬ.  㭪
         fgetchar  ⭮ 㭪樨 fgetc(stdin).

               頥 祭.

                 㭪樨  ⠭ ᨬ.  砥  -
          訡  ⨦  䠩  頥 -
          EOF; , 祭 EOF   ਭ  楫 -
         稭,  ⮣  㦭 ᯮ짮 㭪樨 ferror  feof  -
         ન 訡   䠩.
               . ⠪ fputc, fputchar, getc, getchar.

               砭! 楤 fgetc    fgetchar    getc  
         getchar,    㭪ﬨ,   .

               ਬ:

               #include <stdio.h>
               FILE *stream;
               char buffer[81]; int i; int ch;
               . . .
               /* ᫥騥  롨 ப  ⮪ */
               for (i=0;  (i<80)  &&  ((ch=fgetc(stream))  !=EOF)  &&
               (ch!='\n'); i++)
               buffer[i]=ch;
               buffer[i]='\0';
               /*  襯ਢ    ᡮ ப  ⮪
         stdin      fgetc(stream)       ਬ  㭪
         fgetchar().   ⭮  fgetc(stdin). */


               FGETS


               #include <stdio.h>
               char *fgets(string, n, stream);⠥  ப    ⮪
                                              stream.
               char *string;                    ࠭ .
               int n;                         ᫮ ࠭塞 ᨬ.
               FILE *stream;                  㪠⥫   FILE.



               ᠭ.

               㭪  fgets  ⠥  ப   室 ⮪ stream 
         ᯮ   string.  뢠, 稭    ⥪饩
         樨 stream,  ᨬ  ப '\n'     ⮪,
           ᫮ ⠭ ᨬ  ⠭ ࠢ n-1.  -
           ࠧ頥  string,  ⥬    ᨬ null
         -'\0'.   ப ⠪ 砥  string. ᫨  -
          뢠 n ࠢ﫮 1,  string 㤥 ⮩ (""). 㭪
         fgets 筠 筮 㭪樨 gets, , gets 
         ᨬ  ப 㫥 ᨬ.

               頥 祭.

               㭪 fgets 頥 㪠⥫  ப string.  -
         砥 訡   䠩  頥 祭 NULL.  -
          ⮣,  ந諮 - 訡   䠩, ᯮ-
          㭪樨 feof  ferror.
               . ⠪ fputs, gets, puts.

               ਬ:

               include <stdio.h>
               FILE *stream;
               char line[100], *result;
               /* ᫥騩  롨ࠥ ப  ᨬ    ⮪
         stream.   ⠭   99 ᨬ    ᨬ
          ᨬ  ப '\n',   . */
               result = fgets(line, 100, stream);.


               FIEEETOMSBIN-FMSBINTOIEEE


               #include <math.h>
               int  fieeetomsbin(src4,dst4);८ࠧ ᫮  饩
                                            窮  ଠ.
                                            IEEE   ଠ  -
                                            饩 窮 MS.
               int fmsbintoieee(src4,dst4); ८ࠧ ᫮    筮
                                            ଠ MS   饩 窮
                                              ᫮   饩 窮 
                                            ଠ IEEE.

               ᠭ.

               楤  fieeetomsbin  ८ࠧ뢠  ᫮  ୮
         筮   饩 窮  ଠ IEEE  筮 ଠ
         Microsoft.
               楤 fmsbintoieee ८ࠧ뢠  ᫮    饩
         窮  筮 ଠ Microsoft  ଠ IEEE.
                 楤   ணࠬ ,  뢠
         ᫠  饩 窮  ଠ  IEEE,  ᯮ짮  ᫥
                砩 㯠, ᮧ  
         Microsoft BASIC,  뢠 ᫠   饩  窮  
          ଠ Microsoft  .

               㬥  scr4  㪠뢠   ८ࠧ㥬 float-祭.
          뢠  ᯮ,  㬥⮬ dst4.

               頥 祭.

                㭪樨  0, ᫨ ८ࠧ 뫮 ᯥ
          1, ᫨ ८ࠧ  ९.
               .⠪ dieeetomsbin, dmsbintoieee.

               砭!  楤  ࠡ뢠 IEEE NAN   ᪮-
         筮.  IEEE ࠪ  ८ࠧ  0.


               FILELENGTH


               #include <io.h>              ॡ ⮫쪮  -
                                             㭪樨.
               long filelength(handle);
               int handle;                  handle-, 뫠騩   -
                                             䠩.

               ᠭ.

               㭪 filelength 頥    䠩, 易-
            handle.

               頥 祭.

               㭪 filelength 頥  䠩  . -
         頥 祭 -1L ᢨ⥫  訡   errno ⠭-
           EBADF, ⮡ 㪠   䠩 handle.
               .⠪ chsize, fileno, fstat, stat.

               ਬ:

               #include <io.h>
               #include <stdio.h>
               #include <stdlib.h>
               FILE *stream;
               long length;
               stream=fopen("data","r");
               .
               .
               .
               /*  ᫥騥   । **  䠩,
         易  ⮪ stream */
               length=filelength(fileno(stream));
               if(length==-1L)
               perror("filelength failed");.




               FILENO

               #include <stdio.h>
               int fileno (stream);
               FILE *stream;                㪠⥫   FILE.

               ᠭ.

               㭪 fileno 頥  ⥪騩  handle  ()  䠩,
         易   ⮪ stream. ᫨ ⮪ 易   祬  
         handle-஬    ⮪ ।⥫쭮 ,  ⢥ -
         頥 祭 । handle.

               頥 祭.

               㭪 fileno 頥 handle- 䠩;  砥 訡 -
         頥 祭 . ᫨ ⮪ stream    -
          䠩, ⮣ 頥 祭  ।.
               . ⠪ fdopen, filelength, fopen, freopen.

               砭! Fileno ॠ  .

               ਬ:

               #include <stdio.h>
               int result;
               /* ᫥騩  । handle  䠩    ⮪
         stderr*/
               result= fileno(stderr);      /* १ ࠢ 2 */


               FLOOR


               #include <math.h>
               double floor(x);
               double x;                    祭  饩 窮.

               ᠭ.

               㭪 floor 頥 祭  饩 窮, ।-
         ⠢饥 襥 楫, ஥   ࠢ x.

               頥 祭.

               㭪 floor 頥 १  饩 窮. -
         頥 祭  砥 訡 .
               .⠪ ceil, fmod.

               ਬ:

               #include <math.h>
               double y;
               .
               .
               .
               y = floor(2.8); /* y = 2.0 */

               y = floor(-2.8); /* y = -3.0 */


               FLUSHALL


               #include <stdio.h>
               int flushall();

               ᠭ.

               㭪  flushall  뢠 ᮤন  ஢, -
           묨 input ⮪,  ᮮ⢥騥  䠩.  
         , 易  묨 ⮪, ; ᫥ -
           ⥭  (᫨   ) 뢠    室
         䠩  . ᫥ 맮 㭪樨 flushall   ⮪  -
          묨.

               頥 祭.

                  㭪  頥  ⢮    ⮪
         (室  室).  砥 訡 頥 祭 .
               . ⠪ fflush.

               砭!  ⮬᪨ ,   -
         ,  ⮪ 뢠  ந室 ଠ쭮 襭
         ࠡ ணࠬ   ⮪.

               ਬ:

               #include <stdio.h>
               int numopen;
               .
               .
               .
               /* ᫥騩    /뢮   -
          */
               numopen=flushall();.


               _FMALLOC


               #include <malloc.h>          ॡ ⮫쪮   -
                                              㭪樨.
               char far *_fmalloc(size);
               unsigned size;               ⢮  ⮢  墠祭-
                                             .

               ᠭ.

               㭪  _fmalloc  墠뢠    㬠稢 ᥣ
           ,  ࠩ   訩, 祬    size
         ⮢.  (   , 祬  size ⮢, ਭ-
          ࠭, ஥ ॡ  ࠢ).


               頥 祭.

               㭪 _fmalloc 頥 far-㪠⥫  char.   -
         ,   㪠뢠 頥 祭, ࠭஢ -
         ࠢ   ࠭  ⨯ ꥪ. ⮡  㪠-
         ⥫  ⨯, ⫨  char, ᯮ ८ࠧ⥫ -
          頥 祭.
               㭪 _fmalloc 頥 far-㪠⥫  char. ᫨ 
         㬠稢 ᥣ    筮,  墠 -
          㤥 ७ ᭮, ᯮ   ᥣ. ᫨  
         ᭮ 筮, 頥 祭 ࠢ NULL.
               .⠪ _ffree, _fmsize, malloc, realloc.

               ਬ:

               #include <malloc.h>
               int *intarray;
               /* 墠뢠 ࠭⢮  20 楫 */
               intarray=(int*)_fmalloc(20*sizeof(int));.


               FMOD


               #include <math.h>
               double fmod(x,y);
               double x; 祭  饩 窮.
               double y;

               ᠭ.

               㭪  fmod  ⮪   x  y  -
         饩 窮,  x=iy+f, i - 楫, f -    ,   x;
          ᮫⭮ 祭 x , 祬 ᮫⭮ 祭 y.

               頥 祭.

               㭪  fmod 頥 ⮪  饩 窮. ᫨ y
         ࠢ 0, 㭪 頥 0.
               .⠪ ceil, fabs, floor.

               ਬ:

               #include <math.h>
               double x,y,z;
               x = -10.0;
               y = 3.0;
               z = fmod(x,y); /* z = -1.0 */.


               _FMSIZE


               #include <malloc.h>          ॡ ⮫쪮   -

                                              㭪樨.
               unsigned _fmsize(ptr);
               char far *ptr;               㪠⥫   .


               ᠭ.

               㭪  _fmsize  頥  ࠧ    ,
         墠祭 ।⢮ 맮 _fmalloc.


               頥 祭.

               㭪 _fmsize 頥 ࠧ     
         楫.
               .⠪   _ffree,   _fmalloc,   malloc,   _msize,  _nfree,
         _nmalloc, _nmsize.

               ਬ:

               #include <malloc.h>
               #include <stdio.h>
               main()
               {
               char far *stringarray;
               stringarray=_fmalloc(200*sizeof(char));
               if (stringarray != NULL)
                   printf("%u bytes allocated\n",
                       _fmsize(stringarray));
               else
                   printf("Allocation request failed.\n");
               }


               FOPEN


               #include <stdio.h>
               FILE *fopen(pathname, type);
               char *pathname;              path- 䠩.
               char *type;                  ࠧ襭 ⨯ 㯠.

               ᠭ.

               㭪 fopen  뢠  䠩,  ।塞  path-.
            ப type । ⨯ 㯠, ॡ㥬  䠩-
         , ᫥騬 ࠧ.

                               

            "r"           䠩  ⥭.( 䠩 
                         ⢮).

            "w"           ⮩ 䠩  ; ᫨ 
                         䠩  ࠭  ⢮,   ᮤন

                         㭨⮦.

            "a"           䠩     ()  
                         . ᫨  䠩 ,  砫
                          ᮧ.

            "r+"          䠩 ६    ⥭  
                         .   ⢮.

            "w+"           ⮩ 䠩  ⥭  .
                         ᫨   䠩  ࠭  ⢮,  
                         ᮦন 㭨⮦.

            "a+"           䠩    ⥭   .
                         ᫨ 䠩 , 砫  ᮧ.

               砭! 㦭 ⥫쭮 ਬ  ०  "w",  "w+",
         ⠪    㭨⮦ 騥 䠩.

               ᫨ 䠩    ⨯ "a"  "a+",  樨
          믮   䠩.  ᯮ짮 㭪権 fseek
          rewind   ९樮஢ 㪠⥫  䠩; -
            , 㪠⥫  䠩 । 믮  権
          ᥣ 頥   䠩.  ࠧ,  -
         騥        १ᠭ.   ᯮ짮 ⨯
         "r+', "w+", "a+" ᪠ ६ ⥭  . (-
         ,  䠩 뢠  ). ⮬,   ४-
         祭  ⥭       㦭 ᯮ짮 㭪樨
         fseek  rewind.  㭪樨  fseek  (  室)  
          筮 । ⥪ .
               ⥫쭮    祭, ᠭ ,   -
           ப type   ᫥ ᨬ, ⮡ ᯥ-
         ஢ ᯮᮡ ८ࠧ ᨬ  ப.


                           祭

              t                ⥪⮢   (८ࠧ饬)
                         ०;        "
                         ⪨      -      ॢ       ப"
                         ८ࠧ뢠  ⢥ ᨬ
                         "ॢ  ப".    뢮   ᨬ
                         ॢ   ப   ८ࠧ뢠   
                          -.

              b                筮  (८ࠧ饬)
                         ०;  ᠭ ८ࠧ  
                         ⢫.


               ᫨ t  b  ப type  , ०  ८ࠧ-
           । ६ _fmode  ०, ⠭ 
         㬮砭.



               頥 祭.

               㭪 fopen 頥 㪠⥫   䠩. -
          㪠⥫ NULL ᢨ⥫  訡.
               .⠪  fclose,  fcloseall,   fdopen,   ferror,   fileno,
         freopen, open, setmode.

               ਬ:

               #include <stdio.h>
               main (argc, argv)
               int argc;
               char *argv[];
               {
               FILE *stream;
               /*  ਬ  fopen    䠩,  ண
         ࠭  㪠⥫ argv[argc-1]; ᫨   㤠, ணࠬ
         ᯥ뢠 ᮮ饭  訡 */
               if ((stream= fopen(argv[argc-1]), "r"))==NULL)
                  { fprintf (stderr, "%s    䠩 %s\n",
                             argv[0], argv[argc-1]);
                   exit(1);
               }
               /* 砭!  ணࠬ ࠭  argv[0]  ⮫쪮  
         ᨩ  MS  DOS  3.0   ᫥;  ।  MS DOS,
         argv[0] ᮤন  ப "" */
               ࠧ  ப:

               update employ.dat

                室 㤥 ᮮ饭:

               "C:\BIN\UPDATE.EXE    䠩 employ.dat ".


               FP_OFF - FR_SEG

               #include <dos.h>
               unsigned FP_OFF(longptr);
               unsigned FP_SEG(lohgptr);
               char far *longptr;          long-㪠⥫   .

               ᠭ.

                FP_OFF  FP_SEG   ᯮ짮  ᮮ⢥⢥
            ⠭  ࠧ⢫      ᥣ  ।⢮
         long-㪠⥫ longptr.

               頥 祭.

                FP_OFF 頥  楫 祭,  ।-
         ⠢饥 ࠧ⢫.
                 FP_SEG 頥  楫 祭, ।-
         ⠫饥  ᥣ.
               .⠪ segread.


               ਬ.

               #include <dos.h>

               char far *p;
               unsigned int seg_val;
               unsigned int off_val;
               .
               .
               .
               seg_val=FP_SEG(p);
               off_val=FP_OFF(p);



               _FPRESET

               #include <float.h>
               void _fpreset();             २樠 ⥬-
                                            ᪨   饩 窮.

               ᠭ:

               㭪  _fpreset २樠 ⥬᪨  
         饩 窮.  㭪 筮 ᯮ    楤ࠬ
         signal, system   ᥬ⢮ 楤 exec, spawn.
               ᫨ ணࠬ   㭪樥 signal 墠뢠 ᨣ
         訡    饩  窮 (SIGFPE),    맮 _fpreset
         筮 ⠭  訡  饩 窮  -
          longjmp.

               砭!      MS  DOS,    ࠭  祬   4.0,
         child-, 믮  exec, spawn  system,  -
         ⢮    ﭨ   饩 窮 parent-, ᫨
         ᯮ 8087  80287 ᮯ. ⮬, ᫨  ᯮ-
          ᮯ 8087  80287, ४ , :
               * exec, spawn, system   뢠   -
          ࠦ  饩 窮;
               *  _fpreset     맢 ᫥  楤, ᫨
         child-  믮 ॡ㥬 .

               頥 祭:

               頥 祭 .
               .⠪ execl, execle,  execlp,  execlpe,  execv,  execve,
         execvp,  execvpe,  signal,  spawnl,  spawnle,  spawnlp, spawnlpe,
         spawnv, spawnve, spawnvp, spawnvpe.

               ਬ.

               #include <stdio.h>
               #include <signal.h>
               #include <setjmp.h>
               #include <float.h>


               int fphandler ();
               jmp_buf mark;
               double a = 1.0, b = 0.0, c;

               main()
               {
               if(signal(SIGFPE, fphandler)==(int(*)())-1)
                   abort();
               if(setjmp(mark)==0)  {
                   c = a/b;
                   printf("Should never get here\n");
                   }
               printf("Recovered from floating-point error\n");
               }

               int fphandler(sig,num)
               int sig,num;

               {
               printf("signal=%d subcode =%d\n",sig,num);
               _fpreset();
               /* २樠   饩 窮 */
               longjmp(mark,-1);
               }

               FPRINTF

               #include <stdio.h>

               int fprintf (stream, format-string [, argument ...]);

               FILE *stream; 㪠⥫   FILE.

               char *format-string; ப ࠢ ଠ⮬.

               ᠭ:

               㭪 fprintf ଠ  ⠥  室 ⮪ -
          ᨬ  祭.  㬥 (᫨  ) ८-
           뢮 ᮣ᭮  ᯥ䨪樨 ଠ  -
          ଠ. ப ଠ (format-string)  ⮩  ମ
          㭪樥,   㬥 ப ଠ 㭪樨 printf.

               頥 祭:

                㭪 頥 ⢮ ⠭ ᨬ.
               . ⠪ cprintf, fscanf, printf, sprintf.

               ਬ.

               #include <stdio.h>

               FILE *stream;
               int i = 10;

               double fp = 1.5;
               char *s = " ப";
               char c = '\n';

               stream = fopen("result", "w");

               /* ଠ஢   ࠧ  */

               fprintf (stream, "%s%c", s, c);
               /*  ࠦ " -  ப",   ⥬  ᨬ
          ப */

               fprintf (stream, "%d\n", i);
               /*  ᫠ 10,  ⥬ ᨬ  ப */

               fprintf (stream, "%f", fp);
               /*  ᫠ 1.500000 */


               FPUTC-FPUTCHAR.

               #include <stdio.h>
               int fputc (c, stream); 뢠 ᨬ  ⮪ stream.
               int c; 뢠 ᨬ.

               FILE *stream; 㪠⥫   FILE.

               int fputchar (c); 뢠 ᨬ  ⮪ stdout.
               int c; 뢠 ᨬ.


               ᠭ:

               㭪  fputc  뢠  ⤥ ᨬ ""  室
         ⮪ stream. 㭪 fputchar  ⭮    㭪樨
         fputc(c, stream).

               頥 祭:

                  㭪樨  ᠭ ᨬ. 頥
         祭 EOF ᢨ⥫  訡; , ᪮  -
           EOF  ⠪ ⨭ 楫 祭,   ஢ન
         ᮣ襭  訡 ᯮ 㭪 ferror.

               砭! 楤 fputc    fputchar    putc  
         putchar,    㭪ﬨ,   .
               . ⠪ fgetc, fgetchar, putc, putchar.

               ਬ.

               #include <stdio.h>

               FILE *stream;
               char buffer[81];
               int i;

               int ch;


               .
               .
               .
               /*  騥   뢠 ᮤন   -
         ⮪. ⨬,  뢮 ।⠢     䥪  
         ண ࠦ,  ⠪ ⥫  . */

               for (i = 0; (i < 81) &&
                 ((ch = fputc(buffer[i], stream)) != EOF); i++)
                            ;

               /*    ਢ       ⮪
         stdout  뫮  ᯮ짮  "fputc (stream)" 㭪
         "fputchar ()".*/


               FPUTS

               #include <stdio.h>
               int fputs  (string,  stream);  뢠  பe    ⮪
         stream.
               char *string; 뢮 ப.
               FILE *stream; 㪠⥫   FILE.

               ᠭ:

               㭪  fputs  ப   ⮪ stream. 㫥-
          ᨬ 砭 '\0'  .

               頥 祭:

               㭪 fputs 頥 ᫥ ᠭ ᨬ.  ᫨
           ப string , 頥 祭 0. 祭
         EOF ᢨ⥫  訡.
               . ⠪ fgets, gets, puts.

               ਬ.

               #include <stdio.h>

               FILE *stream;
               int result;
               .
               .
               .
               /* 騩  뢠 ப  ⮪ */

               result = fputs("䠩    \n",stream).



               FREAD


               #include <stdio.h>
               int fread (buffer, size, count, stream);

               char *buffer;   ࠧ饭 .
               int size; ࠧ  .
               int count; ᨬ쭮 ᫮ ꥪ⮢  ⥭.

               FILE *stream; 㪠⥫   FILE.

               ᠭ:

                㭪 ⠥  ꥪ  ࠧ  size    稪
         count  室 ⮪ stream  ᯮ    buffer.
         ⥫    䠩,  易   ⮪ stream (᫨  ),
         㢥稢  ᫮ ⠭ ⮢. ᫨  ࠭  ⮪
             ⥪⮢  ०,   " - "  
         ᨬ "".       㪠⥫  䠩,   
         頥 祭.

               頥 祭:

               㭪  fread  頥  ᫮ ⢨⥫쭮 ⠭
         ꥪ⮢, ஥ , 祬 count,  ᫨    ⥭  
         訡  ⨫  䠩.
               . ⠪ fwrite, read.

               ਬ:

               #include <stdio.h>

               FILE *stream;
               long list[100];
               int numread;

               stream = fopen("data", "r+b");

               /*  ᫥騩    100  -
          楫  ⮪ stream */

               numread = fread((char *)list, sizeof(long), 100, stream);.


               FREE

               #include <maloc.h> ॡ ⮫쪮   㭪樨.

               void free(ptr);
               char *ptr; 㪠⥫  墠祭  .

               ᠭ:

               㭪 free ᢮  . 㬥 ptr 㪠뢠-
           ࠭ 墠祭    ।⢮  맮  calloc,
         malloc,  realloc. ᫮ ᢮ ⮢  ᫮ -
         ⮢, ।  墠  ( १墠). ᫥  -

          ᢮訩  㯥  墠.


               頥 祭:

               頥 祭 .
               .⠪ calloc, malloc, realloc.

               砭!  ⪠  ᢮   ptr (㪠⥫ 
         墠뢠 ।⢮ 맮 calloc, malloc  realloc)  -
          ਢ  ᫥饬 墠  맢 訡.

               ਬ.

               #include <malloc.h>
               #include <stdio.h>

               char *alloc;

               /* 墠뢠 100 ⮢  ᢮  */

               if ((alloc=malloc(100))==NULL

               /* ஢  ࠢ쭮 㪠⥫ */

               printf("unable to allocate memory\n");
               else {
               .
               .
               .
               free(alloc);

               /* ᢮   heap */

               }


               _FREECT

               #include  <malloc.h>  ॡ ⮫쪮   㭪-
         樨.

               unsigned int _freect(size);
               unsigned int size; ࠧ ꥪ  .


               ᠭ:

               㭪 _freect ᮮ頥  ⢥ , ਣ 
         ࠧ饭 ᪮ ,  頥 ਡ⥫쭮  -
         ⢮ 맮  ணࠬ malloc  ࠧ饭 ꥪ -
          ࠧ  㬠稢 ᥣ .



               頥 祭:

               㭪 _freect 頥 ᫮  맮    
         楫.
               .⠪ calloc, _expand, malloc, _memavl, _msize, realloc.


               ਬ.

               main()
               {
               int i;
               printf("Approximate # of times program can call
                     malloc\n");
               printf("to allocate a single integer=%u\n\n",
                     _freect(sizeof(int)));

               /*  뢠 1000 ࠧ malloc, ࠧ  ࠧ ⤥쭮
         楫 */

               for (i=0; i<1000; ++i)
               malloc(sizeof(int));

               printf("Approximate # of times program can call
                     malloc\n");
               printf("to allocate a single integer=%u\n",
                     _freect(sizeof(int)));

               }


               FREOPEN

               #include <stdio.h>
               FILE *freopen (pathname, type, stream);

               char *pathname; path-  䠩.
               char *type; ࠧ襭 ⨯ 㯠.

               FILE *stream; 㪠⥫   FILE.


               ᠭ:

               㭪 freopen 뢠 ⥪騩 䠩, 易  ⮪
         stream,  ७砥  ⮪  䠩, ।塞 path--
         .  㭪 筮 ਬ  ॠ樨  ।-
           ⮪ stdin, stdout, stderr, stdaux, stdprn  䠩, -
         塞 짮⥫.  䠩, 易  ⮪, 뢠-
           ० type,  । ᫥騬 ࠧ:


                               

            "r"           䠩  ⥭.( 䠩 
                         ⢮).


            "w"           ⮩ 䠩  ; ᫨ 
                         䠩  ࠭  ⢮,   ᮤন
                         㭨⮦.

            "a"           䠩     ()  
                         . ᫨  䠩 ,  砫
                          ᮧ.

            "r+"          䠩 ६    ⥭  
                         .   ⢮.

            "w+"           ⮩ 䠩  ⥭  .
                         ᫨   䠩  ࠭  ⢮,  
                         ᮦন 㭨⮦.

            "a+"           䠩    ⥭   .
                         ᫨ 䠩 , 砫  ᮧ.

               砭! 㦭 ⥫쭮 ਬ  ०  "w",  "w+",
         ⠪    㭨⮦ 騥 䠩.

               ᫨ 䠩    ⨯ "a"  "a+",  樨
          믮   䠩.  ᯮ짮 㭪権 fseek
          rewind   ९樮஢ 㪠⥫  䠩; -
            , 㪠⥫  䠩 । 믮  権
          ᥣ 頥   䠩.  ࠧ,  -
         騥        १ᠭ.   ᯮ짮 ⨯
         "r+', "w+", "a+" ᪠ ६ ⥭  . (-
         ,  䠩 뢠  ). ⮬    ४-
         祭  ⥭       㦭 ᯮ짮 㭪樨
         fseek  rewind.  㭪樨  fseek  (  室)  
          筮 । ⥪ .
               ⥫쭮    祭, ᠭ ,   -
           ப type   ᫥ ᨬ, ⮡ ᯥ-
         ஢ ᯮᮡ ८ࠧ ᨬ  ப.

                           祭

              t                ⥪⮢   (८ࠧ饬)
                         ०;        "
                         ⪨      -      ॢ       ப"
                         ८ࠧ뢠  ⢥ ᨬ
                         "ॢ  ப".    뢮   ᨬ
                         ॢ   ப   ८ࠧ뢠   
                          -.

              b                筮  (८ࠧ饬)
                         ०;  ᠭ ८ࠧ  
                         ⢫.

               ᫨ t  b  ப type  , ०  ८ࠧ-
           । ६ _fmode  ०, ⠭ 
         㬮砭.



               頥 祭:

               㭪 freopen  頥  㪠⥫      
         䠩.  ᫨   訡, ० 䠩 뢠   㭪
         頥 祭 㪠⥫ NULL.
               . ⠪ fclose, fcloseall, fdopen, fileno,  fopen,  open,
         setmode.

               ਬ.

               #include <stdio.h>

               FILE *stream;
               .
               .
               .
               /* ᫥騩  뢠 ⮪ stdout  ७-
           ⮪ 㪠⥫ ⮪. */

               stream = freopen ("data2", "w+", stdout);.


               FREXP

               #include <math.h>

               double frext(x,expptr);
               double x; 祭  饩 窮.
               int *expptr; 㪠⥫  楫 ᯮ.

               ᠭ:

               㭪  frexp  ࠧ뢠  祭  饩 窮 x 
          m  ᯮ n, ⠪  ᮫⭮ 祭  m  
           ࠢ 0.5   10  x ࠢ m, 㬭  2  ⥯
         n.  祭 ᯮ n ࠭  ᯮ, 㪠
          expptr.


               頥 祭:

               㭪 frext 頥  m. ᫨ x ࠢ 0,  㭪-
           頥 0    ᯮ. 頥 -
           砥 訡 .
               .⠪ ldex, modf.

               ਬ.

               #include <math.h>

               double x,y;
               int n;
               .
               .
               .

               x = 16.4;
               /* y 㤥 ࠢ .5125, n 㤥 ࠢ 5 */
               y = frexp(x,&n);


               FSCANF.

               #include <stdio.h>
               int fscanf (stream, format-string [, argument ...]);

               FILE *stream; 㪠⥫   FILE.
               char *format-string; ப ࠢ ଠ⮬.

               ᠭ:

               㭪 fscanf 뢠   ⥪饩  樨  ⮪
         stream   , ।塞  㬥⮢ arguments (᫨
          ).
                㬥   㪠⥫  ६  ⨯,
          ᮮ⢥ ⨯,    ப  ଠ.  ப
         ଠ  ࠢ 樥       ᠬ
           祭,   㬥  ப  ଠ    㭪樨
         scanf. (ᠭ 㭪樨 scanf ਢ     -
         ⢠).


               頥 祭:

                 㭪  頥  ᫮ 㤠筮 ८ࠧ 
         ࠢ쭮 祭 . 頥  祭    砥
         ,  ⠭,      祭.  ⪥ 뢠
          䠩  頥 祭 EOF. 頥  祭  0
         砥,   祭 .
               . ⠪ cscanf, fprintf, scanf, sscanf.


               ਬ.

               #include <stdio.h>

               FILE *stream;
               long l;
               float fp;
               char s[81];
               char c;

               stream = fopen ("data", "r");
               .
               .
               .
               /*  ࠧ  */

               fscanf (stream, "%s", s);

               fscanf (stream, "%c", &c);


               fscanf (stream, "%ld", &l);

               fscanf (stream, "%f", &fp);.


               FSEEK.

               #include <stdio.h>
               int fseek (stream, offset, origin);

               FILE *stream; 㪠⥫   FILE.

               long offset; ᫮ ⮢  origin.
               int origin; 砫쭠 .

               ᠭ:

               㭪  fseek ६頥 㪠⥫, ᮮ⢥騩 ⮪
         stream,      ᯮ,  饥    origin  
         offset  ⮢.    ⮪ 믮  
         ᯮ.
               ᫨ ⮪   ,    ᫥饩  樥
         㤥  ⥭,  .
               㬥 origin     ᫥ ⠭, -
         ।  <stdio.h>.


            ORIGIN                
          (筨, 砫)

            SEEK-SET              砫 䠩.

            SEEK-CUR              ⥪  㪠⥫ 
                                  䠩.

            SEEK-END               䠩.

               㭪  fseek ᯮ  ६饭 㪠⥫  -
           䠩. ⥫   ⠪  ࠧ饭    殬
         䠩.  ,  ⪠  ᯮ  㪠⥫  砫  䠩
         ਢ  訡.

               頥 祭:

               㭪 fseek 頥 祭 0, ᫨ 㪠⥫ ᯥ譮
         ६饭.  砥 訡  頥   㫥  -
         .    ன,  ᮢ⨬  樥 seek, (⠪ 
         ନ  ), 頥 祭 ।.
               . ⠪ ftell, lseek, rewind.

               砭!  ⮪,    ⥪⮢  (८ࠧ-
         饬)  ०, ਬ fseek  ࠭祭, .. -
         樨  -    稭 ࠡ⪨ ।  -
         .

                ਢ 樨 (⢨) fseek, ࠭騥 -
           ⮪, 묨  ⥪⮢ ०:
               * ᬥ饭 origin  稭 offset, ࠢ ;

               *  ᬥ饭   砫 䠩  祭 offset, 祭
         ᫥ 맮 㭪樨 ftell.

               ਬ.

               #include <stdio.h>

               FILE *stream;
               int result;

               stream = fopen("data", "r");
               .
               .
               .
               /* ᫥騩  頥 㪠⥫  䠩   砫
         䠩 */

               result = fseek(stream, 0L, SEEK_SET);.


               FSTAT


               #include <sys\types.h>
               #include <sys\stat.h>

               int fstat(handle,buffer);
               int handle; handle-, 뫠騩   䠩.
               struct  stat  *buffer; 㪠⥫   ࠭  -
         ⮢.

               ᠭ:

               㭪  fstat  砥 ଠ  ⮬ 䠩, -
            handle-஬,     ,  -
          㪠뢠 buffer. ,  ⨯  stat  ன    
         <sys\stat.h>, ᮤন ᫥騥 :


                                         祭

         st_mode           ⮢ ᪠  ଠ樨    ०
                           䠩.   S_IFCHR    ⠭,
                           ᫨  handle  뫠   ன⢮.
                               S_IFREG   ⠭,  ᫨
                           handle 뫠   䠩.  
                           ⥭/  짮⥫ ⠭-
                             ᮮ⢥⢥  ०  㯠
                            䠩.

         st_dev              ன⢠ ᪠,ᮤঠ饣

                           䠩,    handle -   砥 㣮
                           ன⢠.

         st_rdev             ன⢠ ᪠,ᮤঠ饣
                           䠩,    handle -   砥 㣮
                           ன⢠
                           (筮 st_dev).

         st_nlink          ᥣ 1.

         st_size            䠩   .

         st_atime          ६ ᫥ 䨪樨 䠩.

         st_mtime          ६ ᫥ 䨪樨 䠩
                           (筮 st_atime).

         st_ctime          ६ ᫥ 䨪樨 䠩
                           (筮 st_atime  st_mtime).


                   ⨯ stat   ⥫ ,
           MS DOS   ᫠.

               頥 祭:

               㭪 fstat 頥 祭 0, ᫨ ଠ  -
          䠩 祭. 頥 祭 -1 ᢨ⥫  
         訡;    ⮬  砥 errno ⠭  EBADF, ।
         ⥬ ᠬ  䠩 handle.
               .⠪ access, chmode, filelength, stat.

               砭! ᫨  handle  뫠    ன⢮,
          ࠧ  ६   stat   ᫠.

               ਬ.

               #include <fcntl.h>
               #include <sys\types.h>
               #include <sys\stat.h>
               #include <stdio.h>

               struct stat buf;
               int fh, result;

               fh=open("tmp/data", O_RDONLY);
               .
               .
               .
               result=fstat(fh,&buf);

               if (result==0)
                   printf("file size is %ld\n",buf.st_size);



               FTELL

               #include <stdio.h>

               long ftell (stream);
               FILE *stream; 㪠⥫   FILE.

               ᠭ:

               㭪  ftell  砥  ⥪  㪠⥫  䠩
         (᫨  ), 易  ⮪ stream.    ࠦ
          ᬥ饭 offset  砫 ⮪ stream.

               頥 祭:

                 㭪  頥  ⥪  .  砥 訡
         頥 祭 -1L.  ன,  ᮢ⨬  -
         樥 seek (⠪  ନ  ),   ⮪  stream
           뫠   䠩, 頥 祭 ।-
         .
               . ⠪ fseek, lseek, tell.

               砭! 祭, 頥 fteel, 䨧᪨  -
          ⮢ ᬥ饭 offset  ⮪, ⮣   ⥪⮢
         ०,  .. ⥪⮢ ० ८ࠧ 樨  - . -
          㭪 ftell   fseek, ⮡ ४⭮ 
          ⠭ ᯮ 㪠⥫  䠩.

               ਬ.

               #include <stdio.h>

               FILE *stream;

               long position;

               stream = fopen ("data", "rb");
               .
               .
               .
               position = fteel(stream);.


               FTIME

               #include <sys\types.h>
               #include <sys\timeb.h>

               void ftime(timeptr);
               struct timeb *timeptr; 㪠⥫  , ᠭ  
         <sys\timeb.h>.

               ᠭ:

               㭪  ftime  ᢥ稢  ⥪饥  ६   ࠭  

         ,   㪠뢠 timeptr.  timeb  ᠭ
           <sys\timeb.h>.   ᮤন  4  : time, millitm, timezone,
         dstflag,   ᫥騥 祭:

                                         

            time                ६,    ᥪ㭤,  襤襥 
                                祭   00:00:00   ६   
                                ਭ, ..  1ﭢ 1970 .

            millitm               ᥪ㭤.

            timezone                ( ࠢ
                                 )  祭  ६
                                  ਭ     ६.
                                祭  timezone । 
                                祭 timezone (. tzset).

            dstflag             㫥  祭,   ᫨   
                                室    /⭥  ६
                                         ⭮
                                ६,  ஥  । 
                                祭   쭮   ६
                                daylight ( . tzset.)


               頥 祭:

               㭪 ftime  祭  , ।
          timeptr. 頥 祭 .
               . ⠪ asctime, ctime, gmtime, localtime, time, tzset.
               ਬ.

               #include <sys\types.h>
               #include <sys\timeb.h>
               #include <stdio.h>
               #include <time.h>

               main()
               {
               struct timeb timebuffer;
               char *timeline;
               time(&timebuffer);

               timeline = ctime(&(timebuffer, time));

               printf ("The time is %.19s.%hu %s",
                        timeline,   timebuffer.millitm,
                        &timeline[20]);
               }

                室 㤥 ᫥ ଠ:

               The time is Wed Dec 04 17:58:29.420 1985.



               FWRITE

               #include <stdio.h>

               int fwrite(buffer, size, count, stream);
               char *buffer; 㪠⥫  뢠 .
               int size; ࠧ   .
               int count; ᨬ쭮 ᫮ 뢠 ⮢.
               FILE *stream; 㪠⥫   ⨯ FILE.

               ᠭ:

               㭪 fwrite 뢠   count    size  
         buffer    室 ⮪ stream. ⥫  䠩, 易 
         stream, 㢥稢  ᫮ ᠭ ⮢.
               ᫨  stream   ⥪⮢ ०,  -
          ⪨  ன " ⪨ - ॢ ப".
          頥 祭 ⠪   믮.

               頥 祭:

                砥 訡, .. ᫨ ᫮  ᠭ  -
         ⮢  ,  祬  count,  ⮣ 㭪 fwrite 頥 
         ᫮.
               . ⠪ fread, write.

               ਬ.

               #include <stdio.h>

               FILE *stream;
               long list[100];
               int numwritten;

               stream = fopen("data", "r+b");
               .
               .
               .
               /* ᫥騩  뢠 100  楫   ⮪
          筮 ଠ */

               numwritten   =   fwrite((char  *)list,  sizeof(long),  100,
         stream);.


               GCVT

               #include <stdio.h> ॡ ⮫쪮   㭪権.

               char gcvt(value, ndec, buffer);
               double value; ८ࠧ㥬 祭.
               int ndec; ⢮   .

               char *buffer;   ࠭ १.


               ᠭ:

               㭪 gcvt ८ࠧ뢠 祭    饩  窮
         value    ᨬ  ப        ப  
         buffer.  buffer   筮 訬,  ⮡  ᬮ
         ࠧ  ८ࠧ  祭     㫥 ᨬ
         砭 '\0',   ⮬᪨. ९ 
         ஫.
               㭪  gcvt ⠥ ࠡ ndec    -
          FORTRAN F. ᫨   㤠,    ࠡ뢠  騥
           ଠ FORTRAN E.  ८ࠧ 騥 㫨 -
         .

               頥 祭:

               㭪  gcvt 頥 㪠⥫  ப .  砥
         訡   頥 祭.
               . ⠪ atof, atoi, atol, ecvt, fcvt.

               ਬ:

               #include <stdio.h>

               char buffer[50];
               int precision = 7;

               /*   ᮤন "-314150.0" */

               gcvt (-3.1415e5, precision, buffer);.


               GETC - GETCHAR

               #include <stdio.h>

               int getc (stream); ⠥ ᨬ  ⮪ stream.

               FILE *stream; 㪠⥫   FILE.

               int getchar(); ⠥ ᨬ  stdin.

               ᠭ:

                getc ⠥ ⤥ ᨬ  ⥪饩 樨 -
          stream   ᮮ⢥騩 㪠⥫  䠩  㪠-
          ᫥饣 ᨬ.  getchar 筠 getc(stdin).


               頥 祭:

                getc  getchar  ⠭ ᨬ. -
         頥 祭 EOF ᢨ⥫  訡   ᫮ -
         ⨦  䠩.  । ⥣ਨ 訡 ᯮ-
          㭪樨 ferror  feof.

               . ⠪ fgetc, fgetchar, getch,  getche,  putc,  putchar,
         ungetc.

               砭!   楤   getc,   getchar    fgetc,
         fgetchar,    ,   㭪ﬨ.

               ਬ.

               #include <stdio.h>

               FILE *stream;
               char buffer[81];
               int i, ch;
               .
               .
               .
               /* ᫥騥   롨 ॡ㥬  -
          ப  stdin */

               for (i = 0; (i < 80) && ((ch = getchar ()) != EOF) &&
                  (ch != '\n'); i++)
                  buffer [i] = ch;

               buffer[i] = '\0';

               /*    ப  ⮪ stdin  , ਢ-
          ,   "getchar ()"  ᯮ짮  "getc(stdin)".
         */


               GETCH

               #include <conio.h> ॡ ⮫쪮   㭪樨.

               int getch();

               ᠭ:

               㭪  getch  ⠥  -⮡ࠦ ⤥ ᨬ
         אַ    ᮫.  ⠭  ()  ᨬ    
         -⮡ࠦ.  ᫨    CONTROLL-C, ⥬ 믮 INT
         23H.

               頥 祭:

               㭪 getch 頥 ⠭ ᨬ.  頥
         祭  砥 訡 .
               .⠪ cgets, getche, getchar.


               ਬ.

               #include <conio.h>
               #include <ctype.h>


               int ch;

               /*   ⮬ 横  ᨬ  ,   -
          " ஡" ᨬ.  ।騥  ᨬ  ஡
         뢠. */


               GETCHE

               #include <conio.h> ॡ ⮫쪮   㭪樨.

               int getche ();

               ᠭ:

               㭪  getche ⠥ ⤥ ᨬ  ᮫  ࠡ-
         뢠   ⠭ ᨬ.  ᫨    CONTROLL-C,
         ⥬ 믮 INT 23H (室  CONTROLL-C).

               頥 祭:

               㭪  getche 頥 ᨬ. 頥 祭 
         砥 訡 .
               .⠪ cgets, getch, getchar.

               ਬ.

               #include <conio.h>
               #include <ctype.h>

               int ch;

               /*  ᨬ  , ࠡ뢠   -⮡-
            ᮫. ᫨  ᨬ 孥 ॣ, ८ࠧ
           ᨬ  ॣ  뢠  ᨬ */.

               ch = getche();

               if (isupper (ch))
                  cprintf ("\b%c", _tolower(ch));


               GETCWD


               #include <direct.h> ॡ ⮫쪮     㭪-
         樨.


               char *getcwd(pathbuf,n);
               char *pathbuf;   path-.
               int n; ᨬ쭠  path-.



               ᠭ:

               㭪  getcwd  砥  path- ⥪饣 ࠡ祣
         ४     pathbuf.  㬥 n ।-
          ᨬ   path-.  訡, ᫨ -
          path-,  㫥 ᨬ 砭, ॢ蠥 n.
               㬥 pathbuf   NULL;   ࠧ஬  n  㤥
         ⮬᪨  墠뢠  ।⢮ malloc  ᯮ짮
          ࠭ path-.        ᢮
           ᯮ짮 頥 祭 㭪樨 getchar (㪠-
         ⥫  墠祭 ) ।⢮ 㭪樨 free.

               頥 祭:

               㭪 getcwd 頥  pathbuf.  頥  祭
         NULL ᢨ⥫  訡   errno ⠭   
         ᫥ 祭:

         祭                       

         ENOMEM                筮  ࠧ饭    n
                                (  㬥  NULL   
                              pathbuf).

         ERANGE               Path- , 祬 n ᨬ.

               .⠪ chdir, mkdir, rmdir.

               ਬ.

               #include <direct.h>
               #include <stdlib.h>

               char buffer [51];

               /*  ᫥騩   뢠  ⥪饣 ࠡ祣 **
         ४ (  50 ᨬ)   */

               if (getcwd(buffer,50)==NULL)
                   perror("getcwd error");


               GETENV.

               #include <stdlib.h> ॡ ⮫쪮     㭪-
         樨.

               char *getenv(varname);
               char *varname;  ६ 㦥.

               ᠭ:

               㭪  getenv 頥 㪠⥫  祭 ६
         㦥  ᮮ⢥饣  varname ⮩ ६. -
         ६ 㦥 । 㦥,    ஬  믮
           (ਬ,    path  ⥪,  
           ணࠬ).


               頥 祭:

               㭪 getenv 頥 㪠⥫    祭  (ப)
         ६  㦥, ᮤঠ ⥪饥 祭 ப varname.
         頥 祭 NULL, ᫨  ६  ⥪騩 -
           ।.
               . ⠪ putenv.

               砭!   ⠡ ६ 㦥 ।-
         ⢥    . ᫨   㦭  ,  -
          㭪 putenv. ⮡ ஢ 頥 -
         祭   ⮬  ஭ ⠡ ६ 㦥, 㦭
         ᯮ짮 㭪樨 strdup  strcpy,   -
          ப.
               㭪樨  getenv    putenv ᯮ  ६
         environ   㯠    ⠡  ६  㦥.  㭪
         putenv      祭 environ,  ⢨⥫
         㬥 "envp"  㭪樨 "main".

               ਬ.

               #include <stdlib.h>

               char *pathvar;

               /* ᫥騩  砥 祭 ६  㦥-
          PATH */

               pathvar = getenv("PATH");

               /* ᫨  㦥   "PATH  =  A:\BIN;  B:\BIN",
          㪠⥫ pathvar 㤥 뫠  "A:\BIN; B:\BIN". ᫨ -
         ६ 㦥 PATH ,㪠⥫ pathvar 㤥 ࠢ NULL.*/


               GETPID

               #include  <process.h> ॡ ⮫쪮   㭪-
         樨.
               int getpid();

               ᠭ:

               㭪 getpid 頥  䨪    ()
         ID,  㭨쭮 । 뢠 .

               頥 祭:

               㭪  getpid 頥 䨪  ID. -
         頥 祭  砥 訡 .
               .⠪ mktemp.


               ਬ.

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

               char filename[9], pid[5];
               .
               .
               .

               strcpy(filename, "FILE");
               strcat(filename, itoa(getpid(), pid, 10));

               /* ⠥ "FILExxxxx",  xxxxx  **  -
         ஬  id */

               printf("File name is %s\n", filename);


               GETS

               #include <stdio.h>

               char *gets(buffer);
               char *buffer;   ࠭  ப.

               ᠭ:

               㭪  gets  ⠥  ப   ⮪ ⠭⭮ 
         stdin      buffer. ப ⮨    
         ᨬ  稢 ᨬ  ப '\n'. । -
         ⮬ 㭪 gets 頥 ᨬ  ப ᨬ '\0',  -
         稨  㭪樨 fgets,  ࠭ ᨬ  ப.


               頥 祭:

               㭪  頥  ᢮ 㬥. 祭 㪠⥫ NULL
         ᢨ⥫  訡  ⨦  䠩.  ।-
          ⥣ਨ 訡 ᯮ 㭪樨 ferror  feof.
               . ⠪ fgets, fputs, puts.


               ਬ.

               #include <stdio.h>

               char line[100];
               char *result;

               /* ᫥騩  롨ࠥ ப  ⮪ stdin */

               result = gets(line);.



               GETW


               #include <stdio.h>

               int getw (stream);

               FILE *stream; 㪠⥫   FILE.

               ᠭ:

               㭪 getw ⠥ 筮 祭 ⨯ int  ᯥ樠-
          ⮪ stream   ᮮ⢥騩 㪠⥫    䠩
         (᫨   ), ⮡ 㪠  ᫥騩 ⠭ ᨬ.
          㭪  । ᯥ樠쭮 ࠢ ꥪ⮢.


               頥 祭:

                㭪 頥 ⠭ 楫 祭. 頥-
          祭 EOF ᢨ⥫  訡   ⨦ 
         䠩; , 祭 EOF   ਭ  楫 -
         稭, ⮬  ஢ન  䠩  ᫮ 訡 ᯮ-
          㭪樨 ferror  feof.
               . ⠪ putw.

               砭! 㭪 getw ᯥ稢 ᮢ⨬  ।-
         騬 ⥪. 室 ,  ஡  ७-
               getw, ᫨  ⥬ ࠧ
         ࠧ int  冷 ⮢  int.

               ਬ.

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

               FILE *stream;
               int i;
               .
               .
               .
               /* ᫥騩  뢠 ᫮   ⮪  stream  
         ஢ 稥 訡 */

               i = getw(stream);

               if (ferror(stream))
               { fprintf(stderr, "getw failed\n");
               clearerr (stream);
               }.


               GMTIME

               #include <time.h>

               struct tm *gmtime(time);

               long *time; 㪠⥫  ࠭ ६.


               ᠭ:

               㭪  gtime  ८ࠧ ६, ࠭  long--
         ,  . Long-祭 time ।⠢  ᥪ㭤,  -
         襤訥   00:00:00 祭 ६  ਭ, ..  1 ﭢ
         1980 .  祭 筮 砥  맮 㭪樨 time.
               㭪 gmtime ࠧ뢠  祭  time    ࠭    
           ⨯ tm,   <time.h>.   
         ࠦ 祭 ६  ਭ,   ⭮ ६.

                  ⨯ tm ࠭ ᫥騥 祭:

                              ࠭ 祭

            tm_sec           㭤

            tm_min           

            tm_hour           ( 0  24)

            tm_mday            ( 1  31)

            tm_mon            ( 0  11; ﭢ=0)

            tm_year           (⥪騩   1900)

            tm_wday            ( 0  6;
                             ᥭ = 0)

            tm_yday            ( 0  365;
                             1 ﭢ = 0)

            tm_isdst         㫥 祭, ᫨  ⢫
                             室  ⭥/ ६, 
                             0.

                MS DOS  ࠭ 1980     .  ᫨  time
         ।⠢    ࠭  1  ﭢ 1980 , gmtime 頥
         ᨬ ப, ।⠢ 00:00:00 January 1,1980.
               頥 祭:

               㭪 gmtime 頥 㪠⥫  १,  ࠭
          . 頥 祭  砥 訡 .
               .⠪ asctime, ftime, ctime, localtime, time.

               砭! 㭪樨 gmtime  localtime ᯮ   
           ᪨ 墠祭   ࠭   ப -
         .  맮    楤 㭨⮦  १-
          ।饣 맮.


               ਬ.

               #include <time.h>

               struct tm *newtime;
               long ltime;

               time(&ltime);
               newtime=gmtime(&ltime);
               printf("Greenwich mean time is %s\n",
                       asctime(newtime));


               HALLOC

               #include  <malloc.h>  ॡ ⮫쪮   㭪-
         樨.

               char huge *halloc(n,size);
               long n; ᫮ ⮢.
               unsigned size;     .

               ᠭ:

               㭪 halloc 墠뢠     huge-ᨢ    n
         ⮢,    size ⮢.   樠-
         ஢  0.
               ᫨ ࠧ ᨢ  祬 128,  ࠧ  -
         ᨢ   ⥯ 2.

               頥 祭:

               㭪 halloc 頥 char-huge 㪠⥫   墠祭-
          ࠭⢮.
                 ,    㪠뢠 頥 祭, -
         ࠭஢ ࠢ  ࠭  ⨯ ꥪ.  ⮡
           㪠⥫  ⨯, ⫨  char, ᯮ ८-
         ࠧ⥫ ⨯  頥  祭.  頥  祭
         ࠢ NULL, ᫨ ⠫ 筮 .
               .⠪ calloc, free, hfree, malloc, realloc.

               ਬ.

               #include <malloc.h>

               long huge *lalloc;
               .
               .
               .

               /*  墠뢠 ࠭⢮, 筮  80000 
         楫,  樠   0 */

               lalloc=(long huge*)halloc(80000L,sizeof(long));






               HFREE

               #include <malloc.h> ॡ ⮫쪮     㭪-
         樨.

               void hfree(ptr);
               char huge *ptr; 㪠⥫  墠祭  .

               ᠭ:

               㭪  hfree ᢮  . 㬥 ptr 㪠-
           ࠭ 墠祭   ।⢮ 맮 halloc.
               ᫮ ᢮ ⮢  ᫮ ⮢,  ।-
            墠 . ᫥ 맮 ᢮訥  -
           ࠧ饭.

               頥 祭:

               頥 祭 .
               .⠪ halloc.

               砭! ⪠ ᢮   ptr  (㪠⥫  
         墠뢠  ।⢮ 맮 halloc)  ਢ  ᫥-
         饬 墠  맢 訡.

               ਬ.

               #include <malloc.h>
               #include <stdio.h>

               char huge *alloc;

               /* 墠뢠 80000 ⮢  ᢮  */

               alloc=halloc(80000L, sizeof (char));
               .
               .
               .
               if (alloc !=NULL)

               /* ஢  ࠢ쭮 㪠⥫ */

               hfree(alloc);

               /* ᢮   heap */

.


               HYPOT

               #include <math.h>

               double hypot(x,y);
               double x,y; 祭  饩 窮.

               ᠭ:

               㭪 hypot      ⥭  אַ㣮쭮
         㣮쭨     ஭ x  y. 맮 hypot -
         ⥭ ᫥饬:
               sqrt(x*x + y*y);


               頥 祭:

               㭪  hypot  頥  ⥭.  砥 -
          १, hypot ⠭ errno  ERANGE  -
         頥 祭 HUGE.
               .⠪ cabs.

               ਬ.

               #include <math.h>

               double x,y,z;

               x = 3.0;
               y = 4.0;
               z = hypot(x,y);
               printf("Hypotenuse=%2.1f\n",z);

                室:

               Hypotenuse = 5.0

.


               INP

               #include <conio.h>      ॡ  ⮫쪮     
                                       㭪樨
               int inp(port);
               unsigned port;           

               ᠭ.

               㭪  inp ⠥ 1    , । 
         port. 㬥 port     楫  ᫮  
         ।  0  65535.

               頥 祭.

               㭪 inp 頥 ⠭   port. 頥-
          祭  砥 訡 .
                ⠪ output.


               ਬ:

               #include <conio.h>
               unsigned port;
               char result;
               .
               .
               .
               /*  ᫥騩      ,  
         ⠭ port */

               result=inp(port);
               INT86
               #include <dos.h>
               int int86(intno,inregs,outregs);
               int ntno;                      (᫮) 뢠 -
               union REGS *inregs;           祭  ॣ஢   맮
               union REGS *outregs;          祭  ॣ஢   -
                                             

               ᠭ.

               㭪 int86 믮 뢠 8086 ணࠬ  -
         祭,  ஥  । ஬ 뢠 intno. । -
          뢠 int86  ᮤন inregs  ᮮ⢥-
         騥 ॣ. ᫥  뢠 㭪  -
         祭 ⥪饣 ॣ  outregs.  ⠪    -
         ७ᨬ  䫠  ⥬    cflag, ᮤঠ饥  outregs.
         㬥 inregs  outregs  ꥤﬨ ⨯ REGS.  
         ꥤ   include-䠩 <dos.h>. ᯮ짮 㭪-
         樨 int86 ।祭  맮 뢠 DOS.



               頥 祭.

               頥 祭  祭  ॣ AX -
           뢠. ᫨  cflag  outregs 㫥, -
          訡  ६ _doserrno ⠪ ⠭ ᮮ⢥-
         騩  訡.
                ⠪ bdos, intdos, intdosx, int86x.

               ਬ:

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

               /*  뢠   023, 墠뢠 楤ன -
         ⪨ 뢠 int_handler.  砭:  祭    
         regs   ᫠  ⮣ 뢠. */

               #define CNTRL_C 0x23
               int int_handler(int);
               union REGS regs;
               .
               .
               .
               signal (SIGINT, int_handler);
               .
               .
               .
               int86 (CNTRL_C, &regs, &regs);


               INT86X

               #include <dos.h>
               int int86x(intno,inregs,outregs,segregs);
               int intno;                     (᫮) 뢠
               union REGS *inregs;           祭  ॣ஢  
                                             맮
               union REGS *outregs;          祭  ॣ஢  
                                             
               struct SREGS *segregs;        祭  ᥣ⮢  
                                             맮



               ᠭ.

               㭪 int86x 믮 뢠 8086 ணࠬ -
         祭,  ஥  । ஬ 뢠 intno.  ⫨稥
          㭪樨 int86, 㭪 int86x ਭ 祭 ॣ ᥣ-
           segregs,  ணࠬ, ᯮ騬 ᥣ  -
           让    far-㪠⥫, ।,  ᥣ
          㪠⥫   ᯮ짮   ⥬ 맮-
         . । 믮 ।  뢠  int86x  
         ᮤন inregs  segregs  ᮮ⢥騥 ॣ.  segregs
         ᯮ  ⮫쪮  祭  ॣ஢ DS  ES. ᫥ 

         뢠 㭪  祭 ⥪饣 ॣ   outregs
           १뢠 DS.  ⠪  ﭨ () -
         ᨬ 䫠 ⥬   cflag, ᮤঠ饥  outregs.  -
         㬥  inregs  outregs  ꥤﬨ ⨯ REGS. -
          segregs  ன ⨯ SREGS.  ⨯  
         include-䠩 <dos.h>. ᯮ짮 㭪樨 int86x ।祭
          אַ 맮 뢠 DOS,   㬥    -
           ES   祭 ॣ DS, ஥ ⫨砥  㬠-
         稢 ᥣ .

               頥 祭.

               頥 祭  祭  ॣ AX -
          饭 뢠. ᫨  flag  outregs   -
         㫥,  訡  ६ _doserrno ⠪ ⠭-
          ᮮ⢥騩  訡.
               .⠪ bdos, intdos, intdosx, int86, segread, FP_SEG.

               砭!  祭  ᥣ    㬥 segreg 
          祭   ᯮ짮 㭪樨 segread, 
          FP_SEG.

               ਬ:

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

               /* 楤 int86x ᯮ  ஢ 뢠-
          021 (⥬ 맮), ,  ᢮ ।, ⨢
         ⥬  맮  "  ਡ⮢"  DOS.  ᯮ
         楤 int86x, ᪮ 뫪   䠩   室
          ᥣ, ⫨筮  㬠稢 ᥣ  (뫪 
           far-㪠⥫), ⮬ ॣ DS   筮 -
           ன SREGS. */

               #define SYSCALL 0x21
               /* INT 21H 뢠 ⥬ 맮 */
               #define CHANGE_ATTR 0x43
               /* ⥬ 맮 43H -  ਡ⮢ */
               char far *filename;
               /*  䠩  far-ᥣ  */
               union REGS inregs, outregs;
               struct SREGS segregs;
               int result;
               .
               .
               .
               inregs.h.ah=CHANGE_ATTR;
               /* AH -  (᫮) ⥬ 맮 */
               inregs.h.al=0;
               /* AL - 㭪 맮 ਡ⮢ */
               inregs.x.dx=FP_OFF(filename);
               /* DS:DX 㪠뢠   䠩 */

               segregs.ds=FP_SEG(filename);
               result=int86x(SYSCALL,&inregs,&outregs,&segregs);
               if (outregs.x.cflag) {
                   printf("can't get attributes of file; error
                           number %d\n", result);
                   exit(1);
                   }
               else {
                   printf("Attribs=%#x\n", outregs.x.cx);
                   }

               INTDOS


               #include <dos.h>
               int intdos(inregs, outregs);
               union REGS *inregs;           祭  ॣ஢  
                                             맮
               union REGS *outregs;          祭  ॣ஢  
                                             

               ᠭ.

               㭪 intdos ⢫ 믮 ⥬ 맮 MS
         DOS,  । 祭 ॣ஢,   inregs,
          頥 १ ⥬  맮    outregs.  㬥
         inregs   outregs  ꥤﬨ ⨯ REGS.  ꥤ-
            include-䠩 <dos.h>.
                ⢫ ⥬ 맮 intdos 믮 -
          INT 21H. । 믮  㭪  ᮤন
         inregs  ᮮ⢥騥 ॣ. ᫥      INT,
         intdos    祭 ⥪饣 ॣ  outregs.  ⠪
           ७ᨬ 䫠 ⥬    cflag,  ࠧ-
         饭  outregs. ᫨    㫥, 䫠 ⠭-
          ⥬ 맮  㪠뢠  ᫮ 訡.
               㭪  intdos ᯮ  믮 ⥬ 맮-
          DOS,   㬥    ॣ,  ⫨    DX
         (DH/DL)  AL,   ⥬ 맮,  । 訡-
          ।⢮ ७ᨬ 䫠.

               頥 祭.

               㭪 intdos 頥 祭 ॣ AX ᫥ -
         襭 ⥬ 맮. ᫨  cflag  outregs  -
         ,   訡   _doserrno ⠭ ᮮ⢥-
         騩  訡.
               .⠪ bdos, intdosx.

               ਬ:


               #include <dos.h>
               #include <stdio.h>
               union REGS inregs, outregs;
               .

               .
               .
               /* ᫥騥   롨  ⥪  ,  ᯮ
         ⭠ 맮 㭪樨 DOS 2a */
               inregs.h.ah=0x2a;
               intdos(&inregs,&outregs);
               printf("date is %d/%d/%d\n", outregs.h.dh,
                       outregs.h.dl, outregs.x.cx);


               INTDOSX

               #include <dos.h>
               int intdosx(intno,inregs,outregs,segregs);
               union REGS *inregs;           祭  ॣ஢  
                                             맮
               union REGS *outregs;          祭  ॣ஢  
                                             
               struct SREGS *segregs;        祭  ᥣ⮢  
                                             맮

               ᠭ.

               㭪  intdosx  ⢫ 믮 ⥬ 맮
         DOS,  । 祭 ॣ,    inregs,
           頥 १ ⥬ 맮  outregs.  ⫨稨 
         㭪樨 intdos, 㭪 intdosx ਭ 祭 ॣ஢ ᥣ-
           segregs,  ணࠬ,  ᯮ ᥣ
          让   far-㪠⥫, ।,    ᥣ-
            㪠⥫   ᯮ짮  殮 ⥬-
          맮. 㬥 inregs   outregs    ꥤﬨ
         ⨯  REGS.㬥  segregs   ன ⨯ SREGS. 
         ⨯   include-䠩 <dos.h>.  ⨢樨 ⥬-
          맮 㭪 intdosx 믮  INT 21H. । 믮-
           㭪  ᮤন inregs  segregs  -
         ⢥騥 ॣ.  segregs  ᯮ  ⮫쪮  祭
         ॣ஢  DS    ES. ᫥   INT intdosx 
         ⥪饥 祭 ॣ  outregs  १뢠 DS.
                ⠪   ७ᨬ 䫠 ⥬  
         cflag, ࠧ饭  outregs. ᫨      㫥,
         䫠 ⠭ ।⢮ ⥬ 맮  㪠뢠 
         ᫮ 訡.
                 ⢨  㭪樨 intdosx    
         ⢨ ⥬ 맮 DOS,   㬥  ॣ
         ES  祭 ॣ DS, ⫨筮   㬠稢  ᥣ
         .

               頥 祭.

               ᫥  襭 ⥬ 맮 㭪 intdosx -
         頥 祭 ॣ AX. ᫨  cflag  outregs  -
         㫥,  訡  _doserrno ⠪  ⠭  ᮮ-
         騩  訡.
               .⠪ bdos, intdos, segread, FP_SEG.


               砭!  祭  ᥣ    㬥 segreg 
          祭   ᯮ짮 㭪樨 segread, 
          FP_SEG.

               ਬ:

               #include <dos.h>
               union REGS inregs, outregs;
               struct SREGS segregs;
               char far *dir = "/test/bin";
               /*᫥騩      ⥪騩 ࠡ稩 ४਩
         맮 ᭠筮 㭪樨 DOS 36 */
                inregs.h.ah=0x3b;
                /*  ४਩ */
                inregs.x.dx=FP_OFF(dir);
                /*  䠩 offset*/
                segregs.ds=FP_SEG(dir);
                /*  䠩 ᥣ */
                intdosx(&inregs,&outregs,&segregs);


               ISALNUM-ISASCII

               #include <ctype.h>
               int isalnum (c);     ஢  ᨬ     -
                                       䠢⭮--
                                    ஢ ⨯ (A-Z,a-z,0-9)
               int isalpha(c);      ஢  㪢 (A-Z,a-z)
               int isascii(c);      ஢    ᨬ   
                                    ASCII (0x00-0x7F)
               int c;               ஢塞 稭

               ᠭ.

               楤,  ᠭ    ctype,  ஢  楫
         祭   㫥 祭, ᫨ 楫 㤮⢮-
          ᫮ ஢ન,  㫥 祭, ᫨ ⮣   ந-
         .  ।,   ⠭ 㤮 ᯮ-
           ASCII.
               楤 isascii 뤠 祭 १   楫-
         ᫥ 祭.  ⠫ 楤 뤠  ।-
           १ ⮫쪮   楫᫥ 祭,  -
           ८ࠧ  ᨬ  ASCII ( ந室 ⮫-
          ⮣,  ஢ઠ   isascii  ⥫ -
         )  祭 EOF (।  <stdio.h>)    ᨬ-
         ,  ਭ  ASCII.
               .⠪   iscntrl,   isdigit,  isgraf,  islower,  isprint,
         ispunct, isspace, isupper, isxdigit, toascii, tolower, toupper.

               砭! 楤 ctype ॠ  .


               ਬ:

               #include <stdio.h>

               #include <ctype.h>
               int ch;
               /*騥    **ᨬ  -
          00  07F, *⠥ "A"  㪢, "AN" -   㪢**-
         ஢ ᨬ  "AS"  ᨬ ** ASCII : */
               for (ch=0;ch<=0x7F;ch++) {
                        printf ("%#04x",ch);
                        printf ("%3S",isalnnum(ch)  ? "AN":" ");
                        printf ("%2S",isalpha(ch)   ? "A":" ");
                        printf ("%3S",isascii(ch)   ? "AS":" ");
                        putchar ('\n');


               ISATTY

               #include <io.h>   ॡ  ⮫쪮      
                                 㭪樨
               int isatty(handle);
               int handle;       handle-, 뫠騩  ஢塞
                                 ன⢮

               ᠭ.

               㭪  isatty ।,    handle- -
           ᨬ ன⢮  (⠪    ନ,  ᮫,
         ਭ  ᫥⥫ ).

               頥 祭.

               㭪 isatty 頥 㫥 祭, ᫨ ன-
         ⢮  ᨬ.  - 頥 祭 0.

               ਬ:

               #include <io.h>
               int fh;
               long loc;
               .
               .
               .
               if (isatty(fh)==0)
               /* ᫨  ன⢮,  뤠 ⥪  */
               loc=tell(fh);


               ISCNTRL-ISXDIGIT

               #include <ctype.h>
               iscntrl(c);        ஢     ࠢ騩
                                  ᨬ (000-01f  0x7F)
               isdigit (c);       ஢   (0-9)
               isgraph(c);        ஢   ⠥ ᨬ-
                                  ,  ᪫  ᨬ   ஡
                                  (021-07e)
               islower(c);        ஢     㪢

                                  (a-z)
               isprint(c);        ஢    ⠥
                                  ᨬ (0x20-0x7e)
               ispunct(c);        ஢     㭪樨
                                  (   ஢ન      
                                  isalnum(c),   iscntrl(c)      
                                  isspace(c)   ⥫
                                  १
               isspace(c);        ஢  ஡ ᨬ
                                  (0x09-0x0d  0x20)
               isupper(c);        ஢    ய  㪢
                                  (A-Z)
               isxdigit(c);       ஢   ⭠
                                    (A-F,a-f, 0-9)
               int c;             ஢塞 楫

               ᠭ.

               楤  ctype, ᠭ , ஢  楫
         祭   㫥 祭, ᫨ 楫 㤮⢮-
          ᫮ ஢ન,  0 -    ⨢  砥.  (ᯮ
         㤮   ᨬ  ASCII).  楤 ࠡ뢠
         । १ ⮫쪮  楫 祭, ᮮ⢥
         ᨬ  ASCII (  ⮫쪮 ⮣,  isascii -
         ⨭)  祭 EOF (।  <stdio.h>),  ᫨  ᨬ
          ਭ  ASCII.
               .⠪   isalnum,  isalpha,  isascii,  toascii,  tolower,
         toupper.

               砭! 楤 ctype ॠ  .

               ਬ:

               #include <stdio.h>
               #include <ctype.h>
               int ch;
               /*  ᫥騥   
               ** ᨬ   00  07f,
               **  "U"  ய 㪢,
               ** "L" -   , "D"  ,
               ** "X"  ⭠ ,
               ** "S"  ஡, "PU"  
               ** 㭪樨, "PR"  ⠥
               ** ᨬ,   "G"  ᪨,
               ** "C"  ࠢ.
               ** ᫨    ⠭,  ⠥.   */
               for (ch=0; ch<=0x7f; ch++)
                 { printf ("%2s", iscntrl (ch)  ? "C":" ");
                   printf ("%2s", isdigit (ch)  ? "D":" ");
                   printf ("%2s", isgraph (ch)  ? "G":" ");
                   printf ("%2s", islower (ch)  ? "L":" ");
                   printf ("%c",  isprint (ch)  ? ch :'\0');
                   printf ("%3s", ispunct (ch)  ? "PU":" ");
                   printf ("%2s", isspace (ch)  ? "S":" ");
                   printf ("%3s", isprint (ch)  ? "PR":" ");

                   printf ("%2s", isupper (ch)  ? "U":" ");
                   printf ("%2s", isxdigit (ch)  ? "X":" ");
                   putchar('\n');
                 }


               ITOA

               #include <stdlib.h>          ॡ   ⮫쪮    
                                             㭪樨
               char *itoa(value,string,radix);
               int value;                   ८ࠧ㥬 ᫮
               char *string;                ப १
               int radix;                   ᭮ value

               ᠭ.

               㭪 itoa ८ࠧ ᨬ ᫠ value    ᨬ
         ப,  稢  NULL-ᨬ,   १ 
         string. 㬥 radix । ᭮ ⥬ ᫥ 
         value;  祭    ।    2    36.  ᫨
         radix  =  10   value - ⥫쭮 ᫮,   ᨬ 
         ப १ 㤥  .

               頥 祭.

               㭪 itoa 頥 㪠⥫  ப.  頥
         祭  砥 訡 .
               .⠪ ltoa, ultoa.

               砭!  , ⢮  string,  
         , 祬 ॡ  頥 ப. 㭪  -
          ப   17 ⮢.

               ਬ:

               #include <stdlib.h>
               int radix=8;
               char buffer[20];
               char *p;
               p=itoa(-3445,buffer,radix); /*p="1712113"*/


               KBHIT

               #include <conio.h>     ॡ ⮫쪮  
                                      㭪樨
               int kbhit();

               ᠭ.

               㭪 kbhit ஢ ⨥   ᮫.

               頥 祭.


               㭪  kbhit  頥 㫥 祭, ᫨ 
         .  ⨢ 砥 頥 0.

               ਬ:

               #include <conio.h>
               int result;
               /* ᫥騩  ஢, 뫠    */
            result = kbhit();
               /* ᫨ १ result 㫥,     ⨥
         .       getch  getche. ᫨ getch
          getche 뫨 맢 㭪樥 kbhit    ஢ન,  ணࠬ
              ᨬ. */


               LABS

               #include <stdlib.h>             ॡ  ⮫쪮  
                                               ᠭ 㭪樨
               long labs(n);
               long n;                          楫 祭

               ᠭ.

               㭪  labs ࠡ뢠 ᮫⭮ 祭 ᢮ -
          楫 㬥 n.

               頥 祭.

               㭪 labs 頥 ᮫⭮ 祭 ᢮ 㬥-
         . 頥 祭  砥 訡 .
               . ⠪ abs, cabs, fabs.

            ਬ:

            #include <stdlib.h>
            long x, y;
            x = -41567L;
            y = labs(x);            /* y = 41567L */


               LDEXP

               #include <math.h>
               double ldext(x,exp);
               double x;            祭  饩 窮
               int *exp;            楫 ᯮ


               ᠭ.

               㭪  ldexp 頥 x, 㬭  2  ⥯ exp.
          砥 ९ १  㭪  頥  +HUGE  
         -HUGE ( ᨬ   x)  ⠭ errno  ERANGE.
               .⠪ frexp, modf.


               ਬ:

               #include <math.h>
               double x,y;
               int p;
               x = 1.5;
               p = 5;
               y = ldexp(x,p);    /* y = 48.0 */


               LFIND - LSEARCH

               #include <search.h>    ॡ ⮫쪮  
                                      㭪樨
               char *lsearch(key,base,num,width,compare);
               char *lfind(key,base,num,width,compare);
               char *key;               ᪠
               char *base;             㪠⥫    ᪮  
                                       
               unsigned *num,width;    ᫮  ࠧ ⮢
               int (*compare)();       㪠⥫  㭪 ࠢ

               ᠭ.

               㭪樨 lsearch  lfind ந ப   -
         祭 key  ᨢ  num ⮢,  ࠧ஬ width .
         ( ⫨稨  bsearch, lsearch  lfind  ॡ ஢-
          ᨢ). 㬥 base  㪠⥫     ᨢ,
          㦭 .
               ᫨ key  , lsearch ᮥ   . 㭪-
          lfind ⮣  .
               㬥  compare  㪠⥫  楤, ⠢-
         塞 짮⥫,  ࠢ    ᨢ  
         頥 祭, ।饥  ⭮襭.  㭪樨 -
           楤  compare  祭 ᪠   ᪮쪮 ࠧ,
         뫠   맮 㪠⥫    ᨢ.  
         楤   ࠢ ,  ⥬   
         ᫥ 祭:

            祭                      

             ࠢ 0           element 1  element 2 ࠧ

               0                 element 1 ࠢ element 2


               頥 祭.

                㭪樨 lsearch  lfind  㪠⥫   ࢮ
          key  ᨢ,   㪠뢠 base.
               ᫨ key  ,  㭪樨  NULL.
               .⠪ bsearch.



               ਬ:

               /* 㭪 lsearch ந ப   ᨢ 
          "key"; lsearch 頥 㪠⥫  , ᫨ 
          ᮤন key,  NULL - ᫨  . */

               #include <search.h>
               #include <string.h>
               #include <stdio.h>
               int compare();
               /*     㭪 */
               main (argc, argv)
               int argc;
               char **argv;
                {
               char **result;
               char *key = "PATH";
               /*  ᫥騩    室  㬥,  稭騩 
         "PATH",  ।,  㬥 ᨪ᪨ -
         ஢ */
               result = (char **)bsearch((char *)&key,
                        (char *)argv, argc, sizeof(char *),
                         compare);
               if (result)
                   printf ("%s found\n", *result);
               else
                   printf("PATH not found!\n");
                 }
               int compare (arg1, arg2)
               char **arg1, **arg2;
                {
                 return(strncmp(*arg1, *arg2, strlen(*arg1)));
                }.


               LOCALTIME

               #include <time.h>
               struct tm *localtime(time);
               long *time;                 㪠⥫  ࠭
                                           ६

               ᠭ.

               㭪  localtime  ८ࠧ뢠  ६,  ࠭   
         long-祭,    . Long-祭 time ।⠢ -
         㭤, 襤訥  00:00:00 祭 ६  ਭ, .. 
         1 ﭢ 1980 .  祭 筮 砥  맮 -
         樨 time.
               㭪 localtime ࠧ뢠 祭 time, ४ -
          ⭮ ६  室   ⭥/  ६,  ᫨  
         祭,    ⪮४஢ ६   ⨯
         tm.( gmtime  ᠭ   tm.)
                MS DOS  ࠭ 1980     .  ᫨  time
         ।⠢   । 1 ﭢ 1980  ,localtime 頥

         ᨬ ப, ।⠢ 00:00:00 January 1,1980.
               㭪 localtime     ⭮ ६-
         , ᫨ 짮⥫  ⠭ ६ 㦥  TZ.
         祭  TZ    㪢 ६ ,
         ਬ PST, ᫥      ᫮,  騬
         ࠧ稥    祭  ६   ਭ   ⭮
         ६. ᫮  ᫥  㪢    室
           ⭥/ ६ (ਬ PDT). 㭪 localtime ᯮ-
          ࠧ  祭 ६  ਭ    -
             ⠭ 祭  ६. ᫨  -
          TZ      室    ⭥/  ६,
         localtime  ⠪   室  ⭥/ ६. ᫨ 
         TZ  ⥪饣 祭, ᯮ 祭 PST8PDT, ⠭-
           㬮砭.
                TZ  ⠭,  ⮬᪨  ⠭  
         㣨 ६ 㦥 - timezone, daylight, tzname. -
          㭪 tzset  ᠭ  ६.

               頥 祭.

               㭪  localtime  頥  㪠⥫    १  
         . 頥 祭  砥 訡 .
               .⠪ asctime, ctime, ftime, gmtime, time, tzset.

               ਬ:

               #include <stddio.h>
               #include <time.h>
               main()
               {
                 struct tm *newtime;
                 char *am_pm="PM";
                 time_t long_time;
                 time(&long_time);
                 newtime=localtime(&long_time);
                 if(newtime->tm_hour<12)
                    am_pm="AM";
                 if(newtime->tm_hour>12)
                    newtime->tm_hour-=12;
                 printf("%.19s %s\n", asctime(newtime), am_pm);
               }

                室:
               Tue Dec 10 11:30:12 AM


               LOCKING

               #include <sys\locking.h>
               #include <io.h>        ॡ ⮫쪮  
                                      㭪樨
               int locking(handle,mode,nbyte);
               int handle;            䠩 handle
               int mode;              ० ஢ 䠩
               int nbyte;             ᫮ ஢ ⮢



               ᠭ.

               㭪 locking     ࠧ    nbytes
         䠩, ।  handle. ஢ ⮢  䠩  ࠧ-
         蠥 ᫥饣 ⥭    ⮢ 㣨 -
         . ஢ 䠩 ࠧ蠥 㣨 ᠬ   -
         뢠  , ஢ ࠭. ஢  ࠧ-
         ஢  稭  ⥪饩 樨 㪠⥫  䠩  -
         ࠭  ᫥ nbyte ⮢    䠩.
               㬥 mode । 믮塞  ⢨  ஢.
              ᫥ manifest-⠭.


         anifest-⠭                祭

         LK_LOCK           ஢  ⮢. ᫨  
                                 ஢,     ந室
                           ୠ ⪠  ஢  १  1
                           ᥪ㭤. ᫨ ᫥ 10 ⮪  
                           ஢, 頥 訡.

         LK_RLCK           筮 LK_LOCK.

         LK_NBLCK          ஢  ⮢.  ᫨ 
                            ஢, 頥 訡.

         LK_NRLCK          筮 LK_NBLCK.

         LK_UNLCK          ஢    ⮢.  
                             ࠭ ஢.


                 䠩   ஢  祬  ,
          ࠡ  ४묨 ﬨ  ᪠. ஬  ⮣,  
               ६    ࠧ஢   祬 
         .
                 䠩  ࠧ,   ࠧ㥬 䠩
          ᮮ⢥⢮  ࠭  ஢  .  㭪
         locking   ࠧ஢ ६ ᬥ , ⠪
            ᫨      ᬥ묨,   
          ࠧ஢ ⤥쭮.
                ஢   㤠  ।  ⨥  䠩
          । 室  ணࠬ.

               頥 祭.

               㭪 locking 頥 0, ᫨  ᯥ譮 믮.
         頥 祭 -1 ᢨ⥫  㤠   errno -
             ᫥ 祭:

         祭                           

         EACCES            ਭ㤨⥫쭠 ஢ (䠩  ᥣ

                           ஢  ࠧ஢).

         EBADF              䠩 handle.

         EDEADLOCK         ਭ㤨⥫쭠 ஢.  祭
                           頥,  ᫨  䫫 LK_LOCK
                             LK_RLCK,  䠩        
                           ஢ ᫥  10 ⮪.

               .⠪ open, creat.

               砭!  㭪  locking   ᯮ짮 ⮫쪮
          ᨩ MS DOS 3.0  ᫥,  ࠭  MS DOS  
            १.

               ਬ:

               #include <io.h>
               #include <sys\locking.h>
               #include <stdlib.h>
               extern unsigned char _osmajor;
               int fh;
               long pos;
               .
               .
               .
               /*  ࠭ ⥪  㪠⥫  䠩, ⥬ -
         ஢   砫 䠩  ࠭ 樨 㪠⥫
          䠩 */
               if (_osmajor >= 3)  {
                  pos=tell(fh);
                  lseek(fh, OL, O);
                  if ((locking(fh, LK_NBLCK,pos)) != -1)  {
                  .
                  .
                  .
                  lseek(fh, OL, O);
                  locking((fh, LK_UNLCK, pos);
                                                           }
                                    }


               LOG-LOG10

               #include <math.h>
               double log(x);     ࠫ  x.
               double log10(x);      x.
               double x;         祭  饩 窮.

               ᠭ.

               㭪樨 log  log10  ᮮ⢥⢥ ࠫ  
           x.


               頥 祭.

               㭪樨  log  log10  १ 䬠. ᫨ x
         ⥫쭮 祭,  㭪樨  ᮮ饭   訡
         DOMAIN   stderr   ⥫쭮 祭 HUGE. ᫨ x
         ࠢ 0,  㭪樨  ᮮ饭  訡 SING   -
          ⥫쭮 祭 HUGE.   ⮬   㣮 砥 errno
         ⠭  EDOM.
               ࠡ⪠  訡     ஢  
         楤 matherr.
               .⠪ exp, matherr, pow.

               ਬ:

               #include <math.h>
               double xx = 1000.0, y;
               y = log(x);   /* y = 6.907755 */
               /* 㭪 log10     -
          祭 */
               y = log10(x); /* y = 3.0 */



               LONGJMP.

               #include <setjmp.h>
               void longjmp(env, value);
               jmp_buf env;                  ६,     ன
                                             ࠭ 㦥
               int value;                    祭,   頥
                                              맮 setjmp.

               ᠭ.

               㭪 longjmp ⠭ ﭨ ⥪, ࠭ -
         ࠭  env 㭪樥 setjmp.
               㭪樨 setjmp  longjmp ᯥ稢   믮-
           쭮  (nonlocal)  室  筮 ᯮ 
         । ࠢ  믮 ࠡ⪨ 訡;  ⠭-
             ࠭ 맢 楤 ( ᯮ짮 筮
         맮);  ᫮ 祭.
               맮 setjmp ࠭ ⥪饥 ﭨ ⥪    env.
         ᫥騩 맮 longjmp ⠭ ࠭ ﭨ 
         頥 ࠢ  㪠⥫ ( 室), ।⢥
         ᫥騩  ᮮ⢥騬 맮 setjmp.
               믮  ,    맮 setjmp 頥
          value.  뢠 longjmp, 祭   ६-
           (  ᪫祭  ६ ॣ) ⠭ 㯭묨
          楤,  ਭ ࠢ   ᮤন  祭
          ६. 祭 ६ ॣ ।᪠㥬.
               㭪 longjmp  뢠 ࠭ 㭪樨, ।-
         饩  setjmp. ᫨ longjmp 맢 ᫥ 㭪樨, ।-
         饩  setjmp,   ந ।᪠㥬 
         ணࠬ.
               祭  value,  頥 longjmp,   㫥-
         . ᫨  value  㬥 0, 祭  -

          祭 1.

               頥 祭.

               頥 祭 .
               . ⠪ setjmp.

               ।०! 祭 ६ ॣ    楤,
         뢠饩 setjmp, ᫥ 믮 longjmp    -
           ᮡ⢥ 祭.


            ਬ:

            #include <stdio.h>
            #include <setjmp.h>
            jmp_buf mark;
            main()
                 {
                 if (setjmp(mark) != 0)
                 {   printf("longjmp has been called\n");
                     recover();
                     exit(1);
                  }
                 printf("setjmp has been called\n");
                 .
                 .
                 .
                 p();
                 .
                 .
                 .
                 }

            p()
                {
                int error = 0;
                .
                .
                .
                if (error != 0)
                   longjmp(mark, -1);
                .
                .
                .
                }

            recover()
                {

               /*    室  ணࠬ 㡥,  䠩  
          祭 */
               .
               .
               .
               }.




               LSEEK


               #include <stdio.h>   ॡ  ⮫쪮   
                                    㭪権.
               long lseek (stream, offset, origin);
               int handle;           handle, 뫠騩   
                                     䠩
               long offset;          ᫮ ⮢  origin.
               int rigin;           砫쭠 .

               ᠭ.

               㭪 lseek । 㪠⥫  䠩 (᫨  ),
         易  handle,    ᯮ, ஥ 
         ⠬ offset  origin.
                  䠩 믮     -
         .
               㬥 origin     ᫥ ⠭, -
         ।  <stdio.h>.

            ORIGIN                

            SEEK-SET              砫 䠩.

            SEEK-CUR              ⥪  㪠⥫ 
                                  䠩.

            SEEK-END               䠩.

               㭪  lseek ᯮ  ६饭 㪠⥫  -
           䠩. ⥫   ࠧ饭    䠩.
          ⪠ ᯮ 㪠⥫  䠩  砫 䠩 -
          ਢ  訡.

               頥 祭.

               㭪  lseek 頥 ࠧ⢫ origin  , -
         ।  祭   樨  砫 䠩. -
         頥 祭 -1 㪠뢠  訡; errno  ⠭  
           ᫥ 祭:

                               

            EBADF                handle- 䠩.

            ENIVAL              ୮ 祭  origin   
                                ,  ।   
                                offset,  室  ।  砫
                                䠩.

                ன,  ᯮᮡ  ᪠ (seek), (⠪

          ନ  ), 頥 祭 ।.
               . ⠪ fseek, tell.

            ਬ:

            #include <io.h>
            #include <fcntl.h>
            #include <stdlib.h>
            int fh;
            long position;
            fh = open("data", O_RDONLY);
            .
            .
            .
            /* 0 - ࠧ⢫  砫 */
            position = lseek (fh, 0L, SEEK_SET);
            if (position == -1L)
               perror("lseek to beginning failed");
            .
            .
            .
            /* 室 ⥪  */
            position = lseek (fh, 0L, SEEK_CUR);
            if (position == -1L)
               perror("lseek to current position failed");
            .
            .
            .
            /* 믮   䠩 */
            if (position == -1L)
               perror("lseek to end failed");.


               LTOA

               #include <stdlib.h>         ॡ    ⮫쪮    
                                            㭪樨
               char *ltoa(value,string,radix);
               int value;                  ८ࠧ㥬 ᫮
               char *string;               ப १
               int radix;                  ᭮ value

               ᠭ.

               㭪 ltoa ८ࠧ ᨬ value  ᨬ ப,
         稢  NULL-ᨬ,    १  string.
         㬥 radix । ᭮ ⥬ ᫥   value;
           祭    ।  2  36. ᫨ radix = 10
          value - ⥫쭮 ᫮,   ᨬ  १饩
         ப 㤥  .

               頥 祭.

               㭪  ltoa 頥 㪠⥫  ப. 頥
         祭  砥 訡 .

               .⠪ itoa, ultoa.

               砭!  , ⢮  string,  
         , 祬 ॡ  頥 ப. 㭪  -
          ப   33 ⮢.

               ਬ:

               #include <stdlib.h>
               int radix=10;
               char buffer[20];
               char *p;
               p=itoa(-344115L,buffer,radix); /*p="-344115"*/


               MALLOC

               #include <malloc.h>    ॡ ⮫쪮  
                                      㭪樨
               char *malloc(size);
               unsigned size;         ⢮ ⮢  墠祭
                                      

               ᠭ.

               㭪 malloc 墠뢠     ࠩ   
         襩,  祬    size ⮢. (   , 祬 size
         ⮢, ਭ ࠭, ஥ ॡ   ࠢ-
            ঠ ଠ樨).

               頥 祭.

               㭪  malloc  頥  char-㪠⥫   墠祭
         ࠭⢮.
                ,   㪠뢠 頥  祭,  -
         ࠭஢  ࠢ  ࠭  ⨯ ꥪ. ⮡
          㪠⥫  ⨯, ⫨  char, ᯮ  ८-
         ࠧ⥫ ⨯ 頥 祭.
               頥  祭 NULL, ᫨ ᢮  ⠫
         .
               .⠪ calloc, free, realloc.

               ਬ:

               #include <malloc.h>
               int *intarray;
               /* 墠뢠 ࠭⢮  20 楫 */
               intarray=(int*)malloc(20*sizeof(int));


               MATHERR

               #include <math.h>
               int matherr(x);
               struct exception *x;     ଠ    ⥬᪨

                                        ᪫祭

               ᠭ.

               㭪 matherr ࠡ뢠 訡, ஦  㭪ﬨ
         ⥬᪮   ⥪.   ⥬᪨   㭪樨  뢠
         matherr,  㦥 訡. 짮⥫    ᯥ
         ࠧ  (।)  㭪樨 matherr, 믮-
         騥 ࠡ ᯥ樠 訡.
               ᫨    ⥬᪮  楤  訡, matherr
         뢠  㪠⥫   ᫥    (  
         <math.h>)  㬥.

               struct exeption {
               int type;
               char *name;
               double arg1, arg2, retval;
               };

               Type  ।  ⨯  ⥬᪮ 訡.   
           ᫥ 祭,   <math.h>

          祭                        

          DOMAIN               訡  (।) 㬥.

          SING                 ᮡ 㬥.

          OVERFLOW             訡  () ९

          UNDERFLOW            訡   稬.

          TLOSS                  稬.

          PLOSS                筠  稬.

                 name  㪠⥫  ப, -
         稢 㫥 ᨬ  ᮤঠ   㭪樨,  맢襩
         訡.    arg1  arg2 । 祭, -
         訥 訡. (᫨  ⮫쪮  㬥,   
           arg1).    訡  㬮砭 頥 祭
         retval.  祭  .    頥  祭
           ।,  ⢨⥫쭮      訡. ᫨
         matherr 頥 0, ᢥ稢 ᮮ饭  訡    errno
         ⠭    ਡ⥫쭮 祭 訡. ᫨ matherr
         頥 㫥 祭, ᮮ饭  訡   ᢥ稢-
            errno ⠥ .


               頥 祭.

               㭪  matherr    砥 訡 頥 0  㫥
         祭, ᫨ ⢨ ୮  ᯥ譮 믮.
               .⠪ acos, asin, atan, atan2, bessel, ccabs, cosh, exp,
         hypot, log, pow, sin, sinh, sqrt, tan.


               ਬ:

               #include <math.h>
               #include <string.h>
               /* 뫠 訡  맮 楤 log  log10.  ᫨
         訡    १⮬  ⥫쭮  㬥  (訡
         DOMAIN), 頥 log  log10  ᮫⭮ 祭  -
         㬥.    ᮮ饭  訡. ᫨ 訡  0
         㬥⮬   訡 ᣥ஢ ன 㣮 楤ன,
         ⢨ 롨ࠥ  㬮砭 */
               int matherr(x)
               struct exception *x;
               {
               if (x->type==DOMAIN) {
                 if(strsmp(x->name,"log")==0\0  {
                    x->retval=log(-(x->arg1));
                    return(1);
                    }
                 else if(strsmp(x->name,"log10")==0) {
                    x->retval=log10(-(x->arg1));
                    return(1);
                    }
               }
               return(0);
               /* ᯮ ⢨  㬮砭 */
               }


               _MEMAVL

               #include <malloc.h>    ॡ ⮫쪮  
                                      㭪樨
               unsigned int_memavl();

               ᠭ.

               㭪 _memavl 頥 ਡ⥫ ࠧ   
         ,  㯭    ᪮  ࠧ饭  㬠稢
         ᥣ .    㭪    ᯮ짮    calloc,
         malloc,  realloc    ।     _nmalloc 
           .

               頥 祭.

               㭪 _memavl 頥 ࠧ     
         楫.
               .⠪ calloc, malloc, _freect, realloc, stackavail.

               ਬ:

               main()
               {
               long *longptr;
               printf("Memory available before malloc=%u\n",

                     _memavl());
               longptr=(long*)malloc(5000*sizeof(long));
               printf("Memory available after malloc=%u\n",
                     _memavl());
               }


               MEMCCPY

               #include <memory.f>          ॡ   ⮫쪮    
               #include <string.h>           㭪樨;   -
                                              <string.h>,
                                             <memory.h.>

               char *memccpy(dest,src,c,cnt);
               char *dest;                   ⥫    १
               char *src;                    ⥫     室
                                             
               int c;                        ᫥     㥬
                                             ᨬ
               insigned cnt;                 ⢮ ᨬ

               ᠭ.

               㭪  memccpy   0   ⮢  src  dest
           ࢮ  ᨬ, 㪠  ६ c (
          ),    㤥 ᪮஢ cnt ⮢.

               頥 祭.

               ᫨  ᨬ  c ᪮஢, memccpy 頥 㪠⥫ 
            dest,  ।⢥ ᫥  ᨬ. -
          c   ᪮஢, memccpy 頥 NULL.
               . ⠪ 㭪樨 memchr, memcmp, memcpy, memset.

               ਬ:

               #include <memory.h>
               char buffer[100],source[100];
               char *result;
               .
               .
               .
               /*    source  buffer,   㤥
               ** ᪮஢ '\n',    100 ⮢
               */
               result=memccpy(buffer,source,'\n',100);


               MEMCHR

               #include <memory.h>       ॡ ⮫쪮 
               #include <string.h>        㭪樨; ᯮ-
                                            <string.h>, 
                                         <memory.h>

               char *memchr(buf,c,cnt);
               char *buf;                 ⥫  
               int c;                     㥬 ᨬ
               unsigned cnt;              ⢮ ᨬ

               ᠭ.

               㭪 memchr 室  cnt ⮢  buf  楫 -
         㦥 ࢮ  ᨬ c.  த   
         ,   㤥  㪠 ᨬ    ஢७
          cnt ⮢.

               頥 祭.

               㭪 memchr 頥 㪠⥫  ᯮ ᨬ
         c    buf.  ᫨  ᨬ c  㤥 㦥   cnt 
         buf, 頥 NULL.
               C. ⠪ memccpy, memcmp, memcpy, memset.

               ਬ:

               #include <memory.h>
               char buffer[100];
               char *result;
               .
               .
               .
               /*   ࢮ ᨬ 'a'  buffer. ᫨ 'a'  
               **  100 , 頥 NULL
               */
               result=memchr(buffer,'a',100);


               MEMCMP

               #include <memory.h>       ॡ    ⮫쪮     
               #include <string.h>        㭪樨; ᯮ-
                                            <memory.h>, 
                                         <string.h>
               int memcmp(buf1,buf2,cnt);
               char *buf1;                 
               char *buf2;                ன 
               unsigned cnt;              ⢮ ᨬ


               ᠭ.

               㭪 memcmp ந ᨪ᪮ ࠢ -
          cnt ⮢  buf1  buf2  頥 祭,  㪠뢠饥
          ᮮ⭮襭  ஢, ⠪   :

                祭                          

                 0                      buf1 ,祬 buf2


                0                             buf1 祭 buf2

                 0                      buf1 ,祬 buf2


               頥 祭.

               㭪 memcmp 頥 楫 ᫮.
               . ⠪ memccpy, memchr, memcpy, memset.

               ਬ:

               #include <memory.h>
               char first[100], second[100];
               int result;
               /* 騩  ࠢ first[]  second[] 
               ** ।,    . ᫨     100
               ** ⮢ 㪠 ஢ ,   -
               **  ࠢ묨 */
               result=memcmp(first,second,100);


               MEMCPY

               #include <memory.h>   ॡ ⮫쪮   
               #include <string.h>   㭪樨;   ᯮ       
                                     <string.h>,  <memory.h>
               char memcpy (dest, src, cnt);
               char *dest;           㪠⥫  १
               char *src;            㪠⥫  室 
               unsigned cnt;         ⢮ ᨬ


               ᠭ.

               㭪  memcpy  cnt ⮢  src  dest. ᫨ -
          ⪨ src  dest ४뢠, memcpy ࠭, 
           ४뢠 ⪠, ਭ騥 src,   ᪮-
         ஢ । १.

               頥 祭.

               㭪 memcpy 頥 㪠⥫  dest.
               .⠪ memccpy, memchr, memcmp, memsct.

               ਬ:

               #include <memory.h>
               char source [200], destiination [200];
               .
               .
               .
               /*  뫠  200 ⮢  **source  destination ** 
         頥 㪠⥫  destination */
               memcpy (destination, source, 200);



               MEMICMP


               #include <memory.h>   ॡ ⮫쪮   
               #include <string.h>   㭪樨;    ᯮ      
                                     <string.h>,  <memory.h>
               int memicmp (buf1, buf2, cnt);
               char *buf1;                     
               char *buf2;                    ன 
               unsigned cnt;                  ⢮ ᨬ

               ᠭ.

               㭪 memicmp  ᨪ᪨  ࠢ    cnt
         ⮢  buf1  buf2  ᨬ  ⨯ ॣ, .. -
          孥   ॣ஢  묨. 㭪
         memicmp 頥 祭, 㪠뢠饥 ᮮ⭮襭 buf1  buf2,
          :

               稭               祭

                0          buf1 , 祬 buf2

               0                 buf1 筮 buf2

                0          buf1 , 祬 buf2

               頥 祭.

               㭪 memicmp 頥 楫 ᫮.
               .⠪ memccpy, memchr, memcmp, memcpy, memset.

               ਬ:

               #include <memory.h>
               char first[100], second [100];
               int result;
               strcpy (first,"Those, Who Will Not Learn from
                       History");
               strcpy  (second,  "THOSE WHO WILL NOT LEARN FROM their
                        mistakes");
               result = memicmp (first, second, 29);
               printf ("%d\n", result);

                室:
                       0


               MEMSET

               #include <memory.h>   ॡ ⮫쪮   
               #include <string.h>   㭪樨;    ᯮ      
                                     <string.h>,  <memory.h>

               char *memset (dest, c, cnt);
               char *dest;                 㪠⥫  १
               int c;                      ᨬ-⥫
               unsigned cnt;               ⢮ ᨬ

               ᠭ.

               㭪 memset   cnt ⮢  dest ᨬ-
          c.

               頥 祭.

               㭪 memset 頥 㪠⥫   dest.
               .⠪ memccpy, memchr, memcmp, memcpy

               ਬ:

               #include <memory.h>
               char buffer [100];
               /*   100 ⮢ buffer
               ** ﬨ */
               memset (buffer, '\0', 100);


               MKDIR

               #include <direct.h>  ॡ  ⮫쪮   
                                    㭪樨
               int mkdir(pathname);
               char *pathname;      path-  ४

               ᠭ.

               㭪 mkdir ᮧ  ४਩   pathname.
                 ६   ᮧ ⮫쪮  ४਩,
         ⮬  ⮫쪮 ᫥   pathname    뢠
          ४਩.

               頥 祭.

               㭪  mkdir 頥 祭 0, ᫨ ᮧ  -
         ४਩. 頥 祭 -1 ᢨ⥫   訡   
         errno ⠭    ᫥ 祭:


         祭                       

         EACCES               ४਩    ᮧ.     
                                  饣  䠩,
                              ४, ன⢠.

         ENOENT               Path-  .

               .⠪ chdir, rmdir.


               ਬ:

               #include <direct.h>
               int result;
               /*  ᫥騥  2    ᮧ 2  ४: **
          -  ୥ ᪠ b, ன -  ४ਨ ** "tmp" ⥪-
          ࠡ祣 ४ */
               result=mkdir("b:/tmp); /*   ᯮ짮
                                      ** ⠪ "b:\\tmp" */
               result=mkdir("tmp/sub"); /*   ᯮ짮
                                        ** ⠪ "tmp\\sub" */



               MKTEMP

               #imclude <io.h>   ॡ ⮫쪮  
                                 㭪樨
               char *mktemp(template);
               char *template;   蠡  䠩

               ᠭ.

               㭪  mktemp  ᮧ  㭨쭮  䠩, 
          template. 㬥 template  :

               baseXXXXXX,

                base     䠩,  ।
         짮⥫   X...X  ⠬  , ନ-
          mktemp; mktemp ࠭ base       䠢
         ᨬ,  ᫥騬   祭  5 . 5-஢ 祭
          㭨 ஬, 騬 뢠 .
          ࢮ 맮 mktemp    template  䠢  ᨬ
         ࠢ  ᨬ  0('0').    ᫥ 맮  ⮣  ᠬ
           ⥬  ᠬ template mktemp ஢, ᯮ짮
          ࠭ 饭   ᮧ 䠩. ᫨ 䠩  -
            , mktemp 頥  .  ᫨  
          ࠭ 饭  䠩 , mktemp ᮧ -
          ,    䠢 ᨬ ᫥饩 㯭 -
           ॣ.
               ਬ,  ᫨  ࢮ 饭  뫮 t012345  
          ᯮ짮  ᮧ 䠩,  ᫥饥  頥
           㤥 ta12345.  ᮧ   mktemp ᯮ '0'
          㪢  ॣ  "a"  "z".

               頥 祭.

               㭪 mktemp  頥  㪠⥫    ஢
         template.  頥  祭    NULL, ᫨ 㬥
         template ࠧ ୮      ᮧ  㭨-
             template.
                ⠪ fopen, getpid, open.

               砭.  㭪 mktemp  㭨  䠩-

         ,   ᮧ   뢠 䠩.

               ਬ:

               #include <io.h>
               char *template="fnXXXXXX";
               char *result;

               /* ᫥騩  뢠 mktemp  ᮧ **  㭨-
         쭮  䠩 */
               result=mktemp(template);
               MODF
               #include <math.h>
               double modf(x,intptr);
               double x;              祭  饩 窮
               double *intptr;        㪠⥫  ࠭ 楫 

               ᠭ.

               㭪  modf  ࠧ뢠  祭   饩 窮 x 
         ஡  楫 . 頥  ஡  x. -
           ࠭  intptr  祭  饩 窮.

               頥 祭.

               㭪 modf 頥  ஡  x. -
          祭  砥 訡 .
               . ⠪ frexp, ldexp.

               ਬ:

               #include <math.h>
               double x,y,n;
               x = -14.87654321;
               y = modf(x,&n);   /* y = -0.87654321, n = -14.0 */


               MOVEDATA

               #include <memory.h>           ॡ   ⮫쪮    -
               #include <string.h>             㭪樨, ᯮ
                                                <string.h>,      
                                             <memory.h>

              void movedata (srcseg,  srcoff,  destseg,  destoff,
                          nbytes);
              int srcseg;                     室 ᥣ
              int srcoff;                    ᬥ饭 室 ᥣ
              int destseg;                    १饣 ᥣ
              int destoff;                   ᬥ饭  १饣 ᥣ-
                                             
              unsigned nbytes;               ⢮ ⮢


               ᠭ.

               㭪 movedata  nbytes ⮢, 稭  室-
          , 祭 srcseg:srcoff,   १, -
         祭 destseg:destoff. 㭪 movedata ।祭   -
         뫪  far-    ணࠬ   । , 
          ᥣ⮢   .  ணࠬ  
           ᯮ짮 㭪 memcpy,      ᥣ⮢
         .

               頥 祭.

               頥 祭 .
               . ⠪ memcpy, segread, FP_SEG.

               砭!  祭  ᥣ⮢    㬥⮢  srcseg  
         destseg   祭     ਬ    㭪樨
         segread,  ம। FR_SEG.
               㭪 movedata  ࠡ뢠  砨 뫮  -
         ४⨥  ४⭮  (뫪   ४⨥ ந室 ⮣,
           १饣    ⮩   -
           室). 뫪  ४⨥ ४⭮ ࠡ-
          㭪樥 memcpy.

               ਬ:

               #include <memory.h>
               #include <dos.h>
               char far *src;
               char far *dest;
               .
               .
               .
               /* ᫥騥  뫠 512
                   ** ⮢   src  dest.   */

               movedata (FP_SEG (src), FPSEG(dest),
                          FP_OFF(dest), 512);


               _ MSIZE

               #include <malloc.h>       ॡ ⮫쪮   
                                         㭪樨

               unsigned_msize(ptr);
               char *ptr;                㪠⥫   

               ᠭ.

               㭪 _ msize 頥 ࠧ   (  ),
         । ।⢮ 맮 calloc, malloc  realloc.

               頥 祭.

               稭   頥   楫.
               . ⠪ calloc, _expand, malloc, realloc.


               ਬ:

               #include <stdio.h>
               #include <malloc.h>
               main()
               {
               long *oldptr;
               unsigned int newsize=64000;

               oldptr=(long*)malloc(10000*sizeof(long));
               printf("Size of memory block pointed to by
                     oldptr=%u\n", _msize(oldptr));

               if (_expand(oldptr,newsize) != NULL)
               printf("expand was able to increase block to
                      %u\n", _msize(oldptr));
               else
                printf("expand was able to increase block to
                       only %u\n", _msize(oldptr));
               }

              _NFREE

               #include <malloc.h>      ॡ ⮫쪮    
                                        㭪樨
               void _nfree(ptr);
               char near *ptr;          㪠⥫    墠祭 
                                        

               ᠭ.

               㭪 _nfree ᢮  . 㬥 ptr 㪠-
           ࠭ 墠祭   ।⢮ _nmalloc.
               ᫮  ᢮ ⮢  ᫮ ⮢, ।-
           墠 . ᫥ 맮 ᢮訥   -
           ࠧ饭.

               頥 祭.

               頥 祭 .
               .  ⠪ _nmalloc, free, malloc.

               砭.  ⪠  ᢮   ptr (㪠⥫ 
         墠뢠 ।⢮ _nmalloc)  ਢ  ᫥饬
         墠  맢 訡.

               ਬ:

               #include <malloc.h>
               #include <stdio.h>

               char near *alloc;

               /* 墠뢠 100 ⮢  ⥬ ᢮  */


               /* ஢ 㪠⥫  ࠢ쭮: */

               if ((alloc=_nmalloc(100))==NULL)
               printf("unable to allocate memory\n");
               else {
                .
                .
                .
               /* ᢮   heap: */

               _nfree(alloc);
                   }

              _NMALLOC

               #include <malloc.h>       ॡ ⮫쪮   
                                         㭪樨

               char near *_nmalloc(size);
               unsigned size;            ⢮ ⮢  墠祭
                                         


               ᠭ.

               㭪 _nmalloc  㬠稢 ᥣ   -
         뢠  ,  ࠩ   , 祬  size -
         ⮢. (   , 祬  size ⮢, ਭ
         ࠭, ஥ ॡ  ࠢ).

               頥 祭.

               㭪 _nmalloc 頥 near-㪠⥫  char.  -
         ,   㪠뢠 頥 祭, ࠭஢ -
         ࠢ   ࠭  ⨯ ꥪ. ⮡  㪠-
         ⥫  ⨯, ⫨  char, ᯮ ८ࠧ⥫ -
          頥 祭.
               頥 祭 NULL, ᫨ ࠭⢮  뫮  -
         祭.
               . ⠪ _nrfee, _msize, malloc, realloc.

               ਬ:

               #include <malloc.h>
               int *intarray;
               /* 墠뢠   20 楫 */
               intarray=(int*)_nmalloc(20*sizeof(int));

               _NMSIZE

               #include <malloc.h>       ॡ ⮫쪮   
                                         㭪樨
               unsigned _nmsize(ptr);
               char near ptr;            㪠⥫   


               ᠭ.

               㭪  _nmsize  頥  ࠧ    ,
         墠祭 ।⢮ _nmalloc.

               頥 祭.

               㭪 _nmsize 頥 ࠧ  ,  
         楫.
               . ⠪  _ffree,  _fmalloc,  _fmsize, malloc, _msize,
        _nfree, _nmalloc.

               ਬ:

               #include <malloc.h>

               #include <stdio.h>

               main()
                 {
                char near *stringarray;

                stringarray=_nmalloc(200*sizeof(char));
                if (stringarray != NULL)
                   printf("%u bytes allocated\n",
                          _nmsize(stringarray));
                else
                   printf("Allocation request failed.\n");
                }


               ONEXIT

               #include <stdlib.h>       ॡ ⮫쪮    
                                         㭪樨
               onexit_t onexit(func);    ⨯  onexit_t,  ।  
                                         <stdlib.h>
               onexit_t func;

               ᠭ.

               㭪 onexit ।  㭪樨 (func),  㤥
         믮, ᫨ ணࠬ ଠ쭮 .  ᯥ  맮
         onexit  ᮧ   㭪権, 믮塞  ࠢ  -
         "᫥ 襫,  襫".     onexit    
         ᮧ         祬  32 㭪権; onexit 頥
         祭 NULL, ᫨ ᫮ 㭪権   ॢ蠥 32. 㭪樨,
         ।  onexit,    ࠬ஢.

               頥 祭.

               㭪 onexit  砥 ᯥ 頥 㪠⥫  -
            頥 NULL, ᫨  ⠫   ࠭ 㪠-
         ⥫  㭪.

            .⠪ exit.

               ਬ:

               #include <stdlib.h>
               main()
               {
               int fn1(), fn2(), fn3(), fn4();
               onexit(fn1);
               onexit(fn2);
               onexit(fn3);
               onexit(fn4);
               printf("This is executed first.\n");
               }
               int fn1()
                   {
                   printf("next.\n");
                   }
               int fn2()
                   {
                   printf("executed");
                   }
               int fn3()
                   {
                   printf("is");
                   }
               int fn4()
                   {
                   printf("This");
                   }


                室:

               This is executed first.
               This is executed next.


               OPEN

               #include <fcntl.h>
               #include <sys\types.h>
               #include <sys\stat.h>
               #include <io.h>        ॡ ⮫쪮  
                                      㭪権.
               int open(pathname, oflag [[, pmode]]);
               char *pathname;        path- 䠩
               int oflag;             㯭 ⨯ 権
               int pmode;             ࠧ襭 ⨯ 㯠.

               ᠭ.

               㭪 open 뢠 䠩, ।塞   path-, 
         ⠢    ᫥饬 ⥭  ,  ।-
          ।⢮ oflag.

               㬥 oflag  楫 ࠦ, 騬  -
         樨         ⠭,    
         <fcntl.h>. ᫨    祬  ⠭, ⮣  -
            ᪮   (:).

            OFLAG                          

            O_APPEND        ⥫   䠩  ६饭   
                            䠩 ।  樥 .

            O_CREAT          䠩 ᮧ    ;
                                䥪⨢,  ᫨  
                            䠩, ।塞  path-.

            O_EXCL          頥  祭   訡,  ᫨
                             䠩, ।塞  path-
                            .  ਬ  ⮫쪮    
                            O_CREATE.

            O_RDONLY            ⮫쪮   ⥭; ᫨
                              䫠,    ࠭
                             䫠 O_RDWR,  O_WRONLY.

            O_RDWR               ६  ⥭
                             ;  ᫨      䫠,
                              ࠭   䫠 O_RDONLY,
                             O_WRONLY.

            O_TRUNC         騩 䠩     祭  
                              0;     䠩     
                            ࠧ襭  . ন 䠩
                            㭨⮦.

            O_WRONLY            ⮫쪮   ⥭; ᫨
                               䫠,      
                            ⠪  䫠 O_RDONLY,  ORDWR.

            O_BINARY              筮 ( ࠭᫨-
                            ஢) ०.  (. ᠭ  -
                            筮 ०  㭪樨 fopen).

            O_TEXT                ⥪⮢   (࠭᫨-
                            饬) ०. (. ᠭ  ⥪-
                             ०  㭪樨 fopen).

               砭!  O_TRUNC  㭨⮦ ᮤন -
         饣 䠩; ⮬ 㦭 ⥫쭮 ᯮ짮    -
         ⠭.
               㬥  pmode  ॡ  ⮫쪮  ⮣,  ।
         ⠭ O_CREAT. ᫨ 䠩 ,  pmode  .  
         ⨢  砥   pmode । ࠧ襭 ⨯ 㯠 
         䠩,  ⠭  ६ ࢮ    
         䠩.
               Pmode  - 楫 ࠦ, ᮤঠ饥    -
          ⠭ S_IREAD, S_IWRITE,   <sys\stat.h>. 

            ⠭,  ꥤ ᪨ ஬ 
         (:). 祭 㬥 pmode ਢ .

                          

            S_IWRITE             ࠧ蠥 .

            S_IREAD              ࠧ蠥 ⥭.

            S_IREAD|S_IWRITE     ࠧ ⥭  .

               ᫨   ࠧ襭, 䠩 ।祭 ⮫쪮  -
         .  MS DOS  䠩   ⥭;      
           ࠧ襭  ⮫쪮   . ⮬,  S_IWRITE 
         S_IREAD: S_IWRITE  묨.
               㭪 open । ⠭ ࠧ襭 㯠  ਪ-
         뢠 ⥪  䠩  pmode. (஡  ⮬ 뢠
          㭪樨 umask).

               頥 祭.

                㭪 頥 handle  ᮧ 䠩. 頥-
          祭 -1 㪠뢠  訡; errno ⠭  
          ᫥ 祭.

                             

            EACCES          path-  ४ਥ;
                            ᤥ ⪠      䠩,
                              ⮫쪮      ⥭,   
                             sharing-襭.  (Sharing-
                           ० 䠩  権  ᪠.
                           ᨨ MS DOS 3.0  ).

            EEXIST          O_CREAT  O_EXCL  ।,  
                            䠩 ᥣ .

            EMFILE         㣨 handle- 䠩  㯭, ..
                             䠩.

            ENOENT           path-  .

               .  ⠪  access,  chmod, close, creat, dup, dup2, fopen,
         sopen, umask.

            ਬ:

            #include <fcntl.h>
            #include <sys\types.h>
            #include <sys\stat.h>
            #include <io.h>
            #include <stdlib.h>
            main ()
             {
              int fh1, fh2;

              fh1 = open("data1", O_RDONLY);
              if (fh1 == -1)
                  perror("open failed on input file");
              fh2 = open("data2", O_WRONLY:O_TRUNC:O_CREAT,
                                  S_IREAD:S_IWRITE);
              if (fh2 == -1)
                  perror("open failed on output file");
              .
              .
              .
             }.
              fh1 = open("data1", O_RDONLY);
              if (fh1 == -1)
                  perror("open failed on input file");.



               OUTP

               #include <conio.h>     ॡ ⮫쪮  
                                      㭪樨
               int outp(port, value);
               unsigned port;          
               int value;             뢮 祭

               ᠭ.

               㭪 outp 뢠 祭 value  室 , -
         ।  port. 㬥 port       
         楫    ।   0  65535, value    楫 
         ।  0  255.
               .⠪ inp.

               ਬ:

               #include <conio.h>
               int port, byte_val;
               .
               .
               .
               /* ᫥騩  뢮    ,  
         ⠭ port. */
               outp (port, byte_val);.


               PERROR

            #include <stdlib.h>            ॡ ⮫쪮 
                                            㭪樨

            void perror(string);
            char *string;                  ᮮ饭, ⠢塞
                                           짮⥫

            int errno;                     稪 訡
            int sys_nerr;                  ᫮ ⥬ ᮮ-
                                           
            char sts_errlist[sys_nerr];    ᨢ   ᮮ饭   
                                           訡.

               ᠭ.

               㭪 perror ⠥ ᮮ饭   訡    stderr.  
         ⮬ ᮮ饭 㬥 string ⠥ , ⥬ ⠥-
          稥, ⥬ ᮮ饭  訡  ᫥ -
         筮 맮, ࠡ⠢襣 訡,   ப.  -
         ⢨⥫쭮 訡 ࠭  ६ errno,  
           譥  ஢. ⥬ ᮮ饭  訡 㯭 १
         ६ sys_errlist,   ᨢ  ᮮ饭  
         稪 訡.
               㭪  perror ⠥ ਡ⥫쭮 ᮮ饭  訡-
         , ᯮ 祭 errno    sys_errlist. 祭
         ६ sys_nerr ।  ᨬ쭮 ᫮ ⮢
          ᨢ sys_errlist.
               ⮡ ࠡ ࠢ १, 㭪 perror -
           맢 ࠧ  ᫥ 筮 楤, -
         饩 訡.   祭 errno      १ᠭ  
         ᫥ 맮.

               頥 祭.

               㭪 perror  頥  祭.
               . ⠪ clearerr, ferror, strerror.

               砭.  MS DOS  祭 errno, ਢ 
         <errno.h>,    ᯮ.    ਫ "饭 
         訡",  ਢ ᯨ᮪ 祭 errno, ᯮ㥬    MS
         DOS,   ᮮ⢥騥 ᮮ饭  訡.  祭 errno,
          ᯮ饣  MS DOS, 㭪 perror ⠥  -
         .


               ਬ.

            #include <fcntl.h>
            #include <sys\types.h>
            #include <sys\stat.h>
            #include <io.h>
            #include <stdlib.h>


            int fh1, fh2;

            fh1 = open("data1", O_RDONLY);
            if (fh1 == -1)
               perror("open failed on input file");

            fh2 = open("data2", O_WRONLY:O_TRUNC:O_CREAT,
                       S_IREAD:S_IWRITE);
            if (fh2 == -1)
               perror("open failed on output file");.


               POW

            #include <math.h>

            double pow(x,y);
            double x;                ᫮
            double y;               ⥯ ᫠ x

               ᠭ.

               㭪 pow  x,   ⥯ y.

               頥 祭.

               㭪 pow 頥 祭 x  ⥯ y. ᫨ y ࠢ
         0, pow 頥 祭 1. ᫨ x ࠢ 0   y  ⥫쭠,
         pow  ⠭ errno  ERANGE  頥 HUGE. ᫨ x -
         ⥫쭮,  y   楫, 㭪 ⠥  ᮮ饭  
         訡 DOMAIN  stderr, ⠭ errno  ERANGE  頥
           ⥫쭮,    ⥫쭮 祭 HUGE.  砥
         ९   稬  ᮮ饭   -
         . .⠪ exp, log, sqrt.

               ਬ.

            #include <math.h>
            double x = 2.0, y = 3.0, z;
            .
            .
            .
            z = pow(x,y);  /* z = 8.0 */


               PRINTF

            #include <stdio.h>

            int printf (format-string [, argument...]);
            char *format-string;       ப ࠢ ଠ⮬.



               ᠭ.

               㭪  printf  ଠ    ⠥  ᨬ 
         祭  室 ⠭ ⮪ stdout. ப ଠ -
         ⮨   ᨬ, escape-᫥⥫쭮⥩ ,  ᫨  
         ப ଠ ᫥ 㬥,      ᯥ䨪樨 ଠ.
           ᨬ   escape-᫥⥫쭮   
         stdout  浪  .

                ਬ, ப

            printf ("Line one\n\t\tLine two\n");

         ࠡ⠥  뢮

            Line one
                            Line two.
                ஡ escape-᫥⥫쭮 뢠  -
          2.2.4 㪮⢠ MSC Compiler Language Reference.

               ᫨  ப ଠ ᫥ 㬥 arguments,  
         ப ⠪  ᮤঠ ᯥ䨪樨 ଠ,  ।騥
         ଠ  뢮  㬥⮢. 䨪 ଠ ᥣ -
           ᨬ  業 (%).    뢠  -
         ஡.
               ப  ଠ  ⠥  ᫥ ࠢ.  砥
         ࢠ ᯥ䨪 ଠ (᫨  ),  祭  ࢮ
         㬥 ᫥ ப ଠ ८ࠧ뢠  뢮 ᮣ-
         ᭮  ᯥ䨪樨.  ᯥ䨪 ଠ 뢠
         ८ࠧ    뢮  ண 㬥  ⠪ ,  
         ப ଠ. ᫨ 㬥⮢ , 祬 ᯥ䨪権 ଠ,
           ⥫ 㬥 .   
         ।,  ᫨ 㬥⮢ 筮   ᯥ䨪-
         権 ଠ.
               䨪 ଠ  ᫥ :

            %[flags][wigth][.precision][{F:N:h:I}]type.

                  ᯥ䨪樨 ଠ  ⤥  ᨬ-
             ᫮,  ࠦ騬  ⤥   ଠ. 
         type, 騩 ᫥ ᫥ 易⥫쭮  ଠ,
         । 㬥  ᨬ,  ப    ᫮.  (.  ⠡.
         R.1.).
               ⥩  ᯥ䨪  ଠ  ᮤন  ⮫쪮 ᨬ
           業    ᨬ  ⨯  (ਬ, %S).  易⥫
           ࠢ 㣨 ᯥ⠬ ଠ஢,  뢠
         .

                                  

            flags          祭   뢮       ,
                           ஡,              祪,
                           쬥         ⭠
                           䨪ᮢ. (. ⠡. R.2.).

            width          쭮 ᫮ 뢮 ᨬ.


            precision      ᨬ쭮 ᫮ ᨬ, ⠥
                             ᥬ        뢮; 
                           쭮  ᫮        
                           楫 祭. (. ⠡. R.3.).

            F, N           䨪, 騥 짮⥫ over-
                           ride,   㬮砭,   ᮣ-
                             .

            F              ᯮ     
                           祭,  far.

            N              ᯮ      ।, 让  
                           huge-   near-祭.

                           F   N   ᯮ짮 ⮫쪮 
                           ⨯ ᨬ s   p,  ᪮  
                           㬥     ⮫쪮        㬥⠬,
                           ।⠢騬 㪠⥫.

            h, l           । ࠧ 㬥:

                           h ᯮ   ⢥  䨪  
                           楫묨   ⨯  d,  i,  o,  x,  X  
                           ।,     㬥   
                           short int.

                           l  ᯮ    ⢥ 䨪 
                           ⨯ d, i, o, x, X    祭,
                             㬥  long int. 
                           l  ᯮ  ⠪    䨪  
                           ⨯  e,  E, f, g, G  ।,
                             㬥    ᪮॥ double,
                           祬 float.

               ᫨  ᨬ   業  (%)  ᫥  ᨬ,  
         騩  ⨯  ଠ,      ᨬ    ⮪
         stdout. ਬ,   ᨬ  業  ᯮ
          %%.


                                                       R.1.

                           ᨬ 㭪樨 printf


                            

              d         楫           楫᫥   
                                        

              i         楫           楫᫥   
                                        

              u         楫             楫᫥

                                        

              o         楫              쬥
                                        楫

              x         楫              ⭠-
                                         楫, ᯮ騩
                                        "abcdef"

              X         楫              ⭠-
                                         楫,
                                        ᯮ騩 "ABCDEF".

              f         饩       祭, 饥
                      窮              [-]dddd.dddd,   
                                        dddd  -       
                                          .    -
                                        ⢮           ।
                                        筮 窮  
                                           稭   ᫠,   
                                        ⢮       ᫥
                                        筮  窨  
                                         ॡ㥬 筮.

             e         饩        祭, 饥
                      窮             [-]d.dddde[sign]ddd,
                                          d - 筠 ,
                                        dddd  -       
                                          ,  ddd  -
                                        ஢        
                                        ,   sign -  "+",
                                         "-".

             E         饩       筮 ଠ "e",  
                      窮            ᪫祭   ⮣,    
                                         "e"  "E".

             g         饩        祭, ᯥ-
                      窮            뢠  ଠ "f" 
                                        "e",    饥  
                                            ࠭
                                        祭   筮  (
                                         ). ଠ "e"
                                        ᯮ, ⮫쪮 
                                        祭 ᯮ 
                                        -4        ,   祬
                                        precision.  騥   㫨
                                        ᥪ,    筠
                                        窠     ⮣,
                                            ᫥ 
                                         ᪮쪮 .

             G        饩        筮  ଠ "g", 
                     窮             ᪫祭    ⮣,   
                                             "e"    

                                        ᯮ "E"  (᫨  
                                        室).

             c       ᨬ         ⤥ ᨬ.

             s       ப          ᨬ       
                                        ࢮ  㫥  ᨬ
                                        '\o'       ⨦
                                        precision.

             n       㪠⥫        ᫮   ᨬ   ᯥ譮
                     楫              뢠        ⮪
                                        stream;        祭
                                        ࠭    楫,  
                                        ண   롨ࠥ  
                                        㬥.

             p       far-㪠⥫       , 㪠뢠-
                                         㬥⮬,      ଥ
                                        xxxx:yyyy,         xxxx
                                          ᥣ⮬,  yyyy
                                         ࠧ⢫,  
                                           x     y  
                                        ⭠묨 ࠬ
                                        孥  ॣ (upper-
                                        case). %Np ⠥ ⮫쪮
                                          ࠧ⢫  yyyy.
                                        ᪮  %p ।
                                        㪠⥫  far-祭,
                                        㬥      p-㪠⥫
                                          襭   far
                                            쪨     
                                        ணࠬ.



                                                       R.2.

                           flags 㭪樨 printf

            FLAG(*)                           

              -      饭 १     饭  ࠢ
                       wigth


              +      ᮥ            "-"  -
                     뢮 祭, ᫨        ⮫쪮
                        ⨯         ⥫-
                                                       
                                                  祭

            blank     뢮 祭 -    ஡
            (' ')    ᮥ ' ', ᫨  -
                      祭  

                        ⥫;
                     䫠  "+"  override   䫠
                     blank,  ᫨    , 
                     ⥫쭮     
                     祭 뢮  
                      

            #         ᯮ짮  ଠ-    䨪
                     ⠬ o, x, X,  䫠 # -
                     ᮥ   㫥-
                       뢮 祭,
                     ᮮ⢥⢥, 0, 0, 0

                      䫠 #  ᯮ   筠 -
                       ଠ  e,  E,  f,        
                     ।   稥 -   ⮫쪮   ⮣,
                     筮  窨   뢮        
                     祭                      

                      䫠 #  ᯮ   筠 -
                      ଠ g, G,  ।-      
                       稥   筮   ⮫쪮   ⮣,
                     窨  뢮 祭        
                       ९  祭    
                      㫥                騥    㫨
                                                  ᥪ

                       # ,  
                      ᯮ짮  ଠ-
                      c, d, i, u, s

               ਬ砭.  ଠ ᯥ䨪樨  ᮤঠ ,
         祬  flag.

               Width  -  ⥫쭮  筮 楫, ஫饥
         쭮 ᫮ ⠭ ᨬ. ᫨  ᫮  ᨬ  
         祭  뢮  , 祬  width, ᫥  ࠢ 
         ஡ ( ᨬ  ⮣,  । 䫠 "-"),  -
         쭠 ਭ  㤥 ⨣. ᫨  width ᮥ
         0,  0     ,   㤥 ⨣ -
          width. (  ਬ  ᥫ, ᬥ饭 ).
               䨪 width  ॡ 祭 祭; ᫨ -
          ᨬ 뢮 祭   祬 ।    width,
              ,  祭 ᨬ ᯥ뢠 (-
          ᯥ䨪樨 precision).
                ᯥ䨪樨 width   窠 (*),  
         祭 ⠢ ᮮ⢥騩  㬥  ᯨ᪠ -
         㬥⮢. 㬥 width  ।襤⢮  ᮮ⢥饬
         祭.
               䨪  precision  ⥫ 
         楫, ஬ ।襤 窠 (.), ।  ⢮
         ⠥ ᨬ    ᫮  .
                 ⫨稨    ᯥ䨪樨  width, ᯥ䨪 precision
         ॡ 祭 뢮 祭 ,   砥  祭  
         饩  窮,  㣫.  砥 ⠭ 㬥

          ᯨ᪠ 㬥⮢   ᯥ䨪樨 precision     -
         窠  (*).   ᯨ᪥ 㬥⮢ 㬥 precision ।襤
         ଠ㥬 祭. ᭥ 祭 precision,  -
           ⨯ type   ,  precision  ய饭,  ।-
         ⠢  ⠡ R.3.

                                                       R.3.

                ⨯ type   祭 precision  㭪樨 printf


                                          

             d     Precision         ।   ᫨   precision
             i     쭮 ᫮ ⠥   ࠢ 0  -
             u     .  ᫨  ᫮        饭,  ᫨
             o     㬥     ,    祬    窠
             x     ࠧ   precision,    ᫥   (.)    
             X     ।   뢮  祭     ,  
                    㫨. ᫨ ᫮   precision  -
                       ॢ室 ࠧ    ࠢ-
                   precision,    祭        1
                   ᥪ

             e     Precision  ।  ᫮   Precision     
             E     ,    ⠥    ᫥   㬮砭  ࠢ
             f     筮  窨. ᫥   6; ᫨  ࠢ-
                   ⠥  㣫     0   ।
                                                     
                                                  窠   (.)  
                                                  ᫥㥬  
                                                  ,      ⮣
                                                  筠 窠
                                                   ⠥

             g     Precision         ।      
             G     ᨬ쭮   ᫮        (-
                   ()    ⠥   ) 
                   ᨬ

             c         ந室        ᨬ
                   ⢨

             s     Precision । -     ᨬ,
                   쭮 ᫮ ⠥           -
                   ᨬ                           㫥
                   ,  ॢ騥 ࠧ   ᨬ
                   precision,  


               頥 祭.

                㭪 頥 ⢮ ⠭ ᨬ.
               .  ⠪  fprintf,  scanf,  sprintf,  vfprintf,  vprintf,
         vsprintf.


               ਬ:

            main ()

         /* ଠ஢   ࠧ  */

            {
            char ch = 'h', *string = "computer";
            int count = 234, *ptr, hex = 0x10, oct = 010, dec = 10;
            double fp = 251.7366;

            printf("%d  %+d  %06d  %X  %x  %o\n\n",
                  count, count, count, count, count, count);

            printf("1234567890123%n45678901234567890\n\n", &count);
            printf("Value of count should be 13; count = %d\n\n",
                   count);

            printf("%10c%5c\n\n", ch, ch);

            printf("%25s\n%25.4s\n\n", string, string);

            printf("%f  %.2f  %e  %E\n\n", fp, fp, fp, fp);

            printf("%i  %i  %i\n\n", hex, oct, dec);

            ptr = &count;
            printf("%Np  %p  %Fp\n",
                   ptr, (int far *) ptr, (int far *)ptr);
            }

              뢮  ᫥饥:

            234  +234  000234   EA  ea  352

            123456789012345678901234567890


            Value of count should be 13; count = 13;
                h    h
                      computer
                               comp

            251.736600    251.74   2.517366e+002   2.517366E+002

            16  8  10

            127A  1328:127A   1328:127A.


            PUTC-PUTCHAR

            #include <stdio.h>


            int putc (c, stream);   뢠 ᨬ  ⮪ stream
            int c;                  뢠 ᨬ

            FILE *stream;           㪠⥫   FILE

            int putchar(c);         뢠 ᨬ  <stdout>
            int c;                  뢠 ᨬ


               ᠭ.

               楤 putc 뢠 ⤥ ᨬ  ""    ⥪
          室 ⮪ stream. 楤 putchar 筠 -
         楤 putc(c, stdout).

               頥 祭.

                   楤   ᠭ ᨬ.  砥
         訡  頥 祭 EOF.     祭  EOF  
           ਭ    楫 稭, ⮬  ஢ન 
          訡 ਬ 㭪 ferror.
               . ⠪ fputc, fputchar, getc, getchar.
               砭: 楤  putc    putchar    fputc  
         fputchar,    ,   㭪ﬨ.

               ਬ:

            #include <stdio.h>

            FILE *stream;
            char buffer[81];
            int i, ch;
            .
            .
            .
         /* ᫥騩      ⮪ */

            for  (i = 0;  (i < 81)  &&  ((ch = putc(buffer[i],
                                               stream)) != EOF) ;)
                     ++i;

         /* 砭: ᪮  ⥫  ⢥ত  ,  
          ந室  ࠦ ஢ન. */


              PUTCH

            #include <conio.h>     ॡ ⮫쪮  
                                   㭪樨

            void putch(c)
            int c;                 뢮 ᨬ



               ᠭ.

               㭪 putch 뢠 ᨬ "c" אַ  ᮫.

               頥 祭.

               頥 祭 .
               .⠪ cprintf, getch, getche.

               ਬ:

            #include <conio.h>

          /*  ᫥饬 ਬ ,    । 㭪-
          getche ।⢮ ᯮ짮 㭪権 putch  getch.*/

            int getche()
            {
                int ch;

                ch=getch();
                putch(ch);
                return(ch);
            }


               PUTENV

            #include <stdlib.h>              ॡ ⮫쪮  
                                              㭪樨

            int putenv(envstring);              ப
            char *envstring;                 㦥

               ᠭ.

               㭪 putenv   ६ 㦥  -
          祭  ६ 㦥.
               ६ 㦥 । 㦥,  ஬ 믮-
            (ਬ,   㬮砭 path  ⥪,
         㥬   ணࠬ).
               㬥 envstring   㪠⥫  ப   ᫥-
         饩 ଥ:

               varname = string,

                varname -  塞  㥬 ६
         㦥    string - 祭 ⮩ ६. ᫨ varname 㦥
             㦥,        ப
         string,  -  㦥   ப string. -
         祭  ६   ⠭ , ᫨ string -
         .
               ⥫  室 () 㦥    ᢮  
          ,  室 () 㦥 ⠥   -
         짮     ६ 㦥  㤥 㪠뢠 
         ᢮ ࠭⢮. 筠  ஡    -

         , ᫨ । 㪠⥫   ६  㭪-
         樨 putenv,  ⥬   ந室 室  㭪,  ன -
          ६.

               頥 祭.

               㭪  putenv  頥 0, ᫨  ᯥ譮 ࠡ⠫.
         頥 祭 -1 㪠뢠  訡.
               . ⠪ getenv.

               砭: 㭪樨 getenv   putenv  ᯮ  
         ६  environ    㯠  ⠡ ६ 㦥.
         㭪 putenv   祭 environ,   ⢨-
         ⥫ 㬥 "envp"  㭪樨 "main".

               ਬ:

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

               /* ⪠  ६ 㦥 */

            if (putenv("PATH=a:\\bin;b:\\tmp") == -1)
            {   printf("putenv failed -- out of memory");
                exit(1);
            }



               PUTS

            #include <stdio.h>

            int puts (string);
            char *string;                    뢮 ப


               ᠭ.

                 㭪 뢠 ࠭ ப string  ⠭-
          ⮪ 뢮 stdout,   室 ⮪ 㫥 ᨬ
         砭 ப ('\0') ᨬ  ப ('\n').

               頥 祭.

               㭪 puts 頥 ᫥ ᠭ ᨬ,  -
          筮  ᨬ  ப '\n'. 祭 EOF ᢨ-
         ⥫  訡.
               . ⠪ fputs, gets.

               ਬ:

            #include <stdio.h>


            int result;

               /* ᫥騩    ᪠ "⠢-
          ᪥  묨    "  stdout. */

            result = puts("Insert data disk and strike any key");.


               PUTW

            #include <stdio.h>

            int putw(binint, stream);
            int binint;              뢮 筮 楫

            FILE *stream;            㪠⥫   FILE

               ᠭ.

               㭪 putw 뢠 筮 祭 ⨯ int   ⥪-
             ⮪ stream.  㭪  ࠢ  
         ⮪   । ᯥ樠쭮 ࠢ.

               頥 祭.

               㭪 putw 頥 ᠭ 祭.  祭  EOF
         ᢨ⥫    訡.  ᪮ EOF   ਭ
         ⠪  楫 稭,   ஢ન 訡     -
         짮 㭪 ferror.
               . ⠪ getw.
               砭:  㭪  ᯥ稢 ᮢ⨬
          ।騬 ⥪. 㦭 ,   ᯮ짮
           㭪樨     ஡ ७ᨬ  
         ⥬   ⥬, ᪮   ⫨ ࠧ  int
          冷 ᯮ ⮢  int.

               ਬ:

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

            FILE *stream;
            .
            .
            .

               /*  ᫥騥       ᫮  ⮪
         stream  ஢  稥 訡. */

            putw(0345, stream);

            if (ferror(stream))
            {     fprintf(stderr, "putw failed\n");
                  clearerr(stream);
            }



               QSORT

            #include <search.h>    ॡ ⮫쪮  
                                   㭪樨

            void gsort(base,num, width, compare);
            char *base;
            unsigned num, width;
            int (*compare)();

               ᠭ.

               㭪 qsort 믮  ன ஢,  ⮡
         ஢  ᨢ    num ⮢,   ࠧ஬
         width . 㬥 base  㪠⥫      ᨢ,
           㦭  ஢.  㭪 qsort १뢠 
         ᨢ  ஢묨 ⠬.
               㬥 compare  㪠⥫  楤,  ⠢-
         塞  짮⥫,   ࠢ   ᨢ 
         頥 祭, ।饥  ⭮襭.
               㭪 qsort  뢠  楤  compare    
         ᪮쪮  ࠧ   ஢, ।   맮
         㪠⥫    ᨢ.  楤    ࠢ
         ,  ⥬    ᫥ 祭:

            祭                    

             0           element 1  element 2

               0               element 1 ࠢ element 2

             0           element 1  element 2


               頥 祭.

               頥 祭  砥 訡 .
               .⠪ bsearch, lsearch.

               ਬ:

            #include <search.h>
            #include <string.h>
            #include <stdio.h>

            int compare ();
            /*     㭪 */

            main (argc, argv)
                int argc;
                char **argv;
                {
                .

                .
                .
               /*  ᫥騩   㬥  ப
          ᨪ᪮ 浪: */

                qsort((char*)argv,argc,sizeof(char*),compare);
                for (i=0; i<argc; ++i)
                  printf("%s\n", argv[i]);
                .
                .
                .
                }

            int compare (arg1, arg2)
               char **arg1, **arg2;

               {
               return(strcmp(*arg1, *arg2));
               }


               RAND

            #include<stdlib.h>              ॡ ⮫쪮   
                                             㭪樨

            int rand;

               ᠭ.

               㭪 rand 頥 ᥢ砩 楫    ࢠ
          0  32767. 楤 srand  ᯮ짮 । 맮
         rand  ⠭ 砫쭮 砩 窨.

               頥 祭.

               㭪 rand 頥 ᥢ砩 ᫮.
               . ⠪ srand.

               ਬ:

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

            int x;

         /* ⠥ 20  ᣥ஢ 砩 ᥫ */

            for (x = 1; x <= 20; x++)
                printf("iteration %d, rand=%d\n", x, rand());.




               READ

            #include<io.h>        ॡ ⮫쪮  
                                  㭪樨

            int read(handle, buffer,count)
            int handle;           handle-,  뫠騩  -
                                   䠩
            char *buffer;           ࠭ 
            unsigned int count;   ᨬ쭮 ⢮ ⮢

               ᠭ.

               㭪 read    count  䠩, 易-
           handle,   buffer. 樨 ⥭ 稭  ⥪-
         饩 樨 㪠⥫  䠩,  ᮮ⢥  䠩-
         .  ᫥ 믮 樨 ⥭  㪠⥫ ⠭-
           ᫥騩 ⠭ ᨬ.

               頥 祭.

               㭪 read  頥  ᫮  ⢨⥫쭮  ⠭
         ⮢, ஥   , 祬 count. 頥 -
          0 㪠뢠   ⥭  䠩,  1 - ᢨ⥫-
            訡;    errno ⠭  祭,
         ஥ ᠭ .

            稭          ᫮ 祭

            EBADF        handle ,  䠩  -
                           ⥭,     䠩
                        ஢ (). ( MS DOS 3.0
                         ᫥騥).

               ᫨ ⠭  32 (ᨬ ࠧ ⨯ int) 
         䠩, 頥 祭 㤥 ⨯ unsigned int  (.ਬ,
         ਢ ).  ᨬ쭮 ᫮ ⮢, ஥ -
             䠩, ࠢ 65534; ᪮ 65534 ( OXFFFF)
          ⫨稬  -1, ⮬ 㤥 饭 訡. ᫨
         䠩   ⥪⮢ ०, 頥  祭    
         ᮮ⢥⢮  ⢨⥫쭮 ⠭ ⮢. ᫨ ⥪-
         ⮢  ० 䥪⨢,   "-"  ᨬ
         . 뢠  頥 祭 ⮫쪮 ⤥  ᨬ-
          .      㪠⥫ 䠩.
               .⠪ creat, fread, open, write.

               砭:  MS DOS,  䠩   ⥪⮢  ०,
         ᨬ  ࠪ       䠩. ᫨ 砥
         CONTROLL-Z, ⥭ 稢   ᫥饬 ⥭  -
           0  ⮢.      䠩  ९⢮
         ⪥ 䠩.

               ਬ:

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


            char buffer [60000]

            main ()
             {
               int fh;
               unsigned int nbytes=60000, bytesread;

               if ((fn=open("c:/data/conf.dat",O_RDONLY))==-1) {
                      perror("open failed on input file");
                      exit (1);
                      }
               if ((bytesread=read(fh,buffer,nbytes))==-1)
                      perror("");
               else
                   printf("Read %u bytes from file\n",bytesread);
               .
               .
               .
               }


               REALLOC

            #include <malloc.h>    ॡ ⮫쪮  
                                   㭪樨

            char *realloc(ptr,size);
            char *ptr;             㪠⥫   ࠭ 墠祭
                                    
            unsigned size;          ࠧ  

               ᠭ.

               㭪 realloc  ࠧ  ࠭  墠祭  
         . 㬥 ptr 㪠뢠  砫 . 㬥 size -
           ࠧ   . ন   .
         㬥  ptr   㪠뢠  ,    ᢮-
          ०,  祬  ᫥  맮  calloc,  halloc,  malloc,
         realloc.

               頥 祭.

               㭪  realloc 頥 char-㪠⥫  १墠祭-
           .    ।, ᫨  ࠧ -
         , ⮬ 㬥 ptr  㭪樨 realloc    易⥫쭮
           ⠪ ,   頥 祭.
               頥 祭 NULL, ᫨  筮, ⮡
              ࠧ. ᫨  ந室,  -
         砫  ᢮.
                ,   㪠뢠 頥  祭,  -
         ࠭஢  ࠢ  ࠭  ⨯ ꥪ. ⮡
          㪠⥫  ⨯, ⫨  char, ᯮ  ८-
         ࠧ⥫ ⨯ 頥 祭.
               .⠪ caloc, free, halloc, malloc.


               ਬ:

            #include <malloc.h>
            #include <stdio.h>

            char *alloc;

            /*  롨ࠥ  筮  讥  ࠭⢮  50
            ᨬ */

            alloc=malloc(50*sizeof(char));
            .
            .
            .

               /* १墠뢠 ,  ᮤন 100 ᨬ */
            if (alloc != NULL)
               alloc=realoc(alloc,100*sizeof(char));


               REMOVE

            #include <io.h>     ॡ  ⮫쪮    
                                㭪樨
            #include <stdio.h>  ᯮ    <io.h>,     
                                <stdio.h>

            int remove(pathname);
            char *pathname;     path- 㤠塞 䠩

               ᠭ.

               㭪 remove 㤠 䠩, ।  pathname.

               頥 祭.

               㭪 remove 頥 0, ᫨ 䠩 ᯥ譮 㤠. -
         頥 祭 -1 ᢨ⥫  訡   errno ⠭-
             ᫥ 祭.


               祭                          

         EACCES               path- । ४਩  䠩
                              ⮫쪮  ⥭

         ENOENT               䠩  path-  

               .⠪ close, unlink.

               ਬ:

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


            int result;

            result=remove("tmpfile");
            if (result == -1)
              perror("couldn't delete tmpfile");


               RENAME

            #include <io.h>    ॡ  ⮫쪮     
                               㭪樨
            #include <stdio.h> ᯮ      <io.h>,    
                               <stdio.h>

            int rename (oldname,newname);
            char *oldname;      㪠⥫  ஥ 
            char *newname;      㪠⥫   

               ᠭ.

               㭪 rename २뢠 䠩  ४਩, ।-
         塞   newname. Oldname   path- -
         饣  䠩   ४. Newname  ।  㦥 -
         饣 䠩  ४. 㭪 rename   ᯮ짮-
             ६饭  䠩   ४  㣮, ᫨
          㣮 path-  㬥 newname. , 䠩   -
             ६饭    ன⢠  㣮 (ਬ, 
         ᪮   ᪮ ). ४ਨ    २뢠  
          ६.

               頥 祭.

               㭪  rename 頥 0, ᫨  믮 ᯥ譮. 
         砥 訡 頥 㫥 祭   errno ⠭-
             ᫥ 祭:


               祭                           

         EACCES                   ४਩,       
                              newname,       
                              ᮧ (  path),     oldname
                                  ४ਥ        newname
                              । 㣮  path.


         ENOENT                 path-,   oldname,
                                .

         EXDEV                ⪠  ६饭  䠩    㣮
                              ன⢮.


               .⠪ create, fopen, open.


               砭. 㦭 ,  冷 㬥⮢   rename
          Microsoft C 4.0 ⨢ 浪 rename  ࠭ -
         ᨩ.      뫮  ᤥ   ᮮ⢥⢨ 
         ⠭⮬ ANSI.

               ਬ:

            #include <io.h>

            int result;

               /* ᫥騩    䠩 "input" **   
         "data" */

            result = rename("input", "data");


               REWIND

            #include <stdio.h>

            void rewind(stream);

            FILE *stream;            㪠⥫   FILE.

               ᠭ.

               㭪 rewind ६頥 㪠⥫   䠩,  易  
         ⮪ stream,  砫 䠩. 맮 㭪樨 rewind ⥭
         맮 ᫥饩 㭪樨:

            fseek(stream, OL, SEEK_SET);

                ⮬ ⮣,   ⮪ rewind 頥 訡  -
            䠩,  fseek ⮣  . Fseek 頥 -
         祭,஥ ।, ᯥ譮    ।  㪠⥫.
         Rewind  頥  祭.

               頥 祭.

               頥 祭 .
               . ⠪ fseek, ftell.

               ਬ:

            #include <stdio.h>

            FILE *stream;
            int data1, data2;
            .
            .
            .
            fprintf(stream, "%d  %d", data1, data2);
            /* ᯮ   䠩 */


            rewind(stream);
            /* ⠥ 䠩  */

            fscanf(stream, "%d", &data1);.


               RMDIR

            #include <direct.h>  ॡ  ⮫쪮   
                                 㭪樨

            int rmdir(pathname);
            char *pathname;      path- 㤠塞 ४

               ᠭ.

               㭪 rmdir 㤠 ४਩, ।塞  pathname.
         ४਩          ⥪騬 ࠡ稬
         ४ਥ  ४ਥ .

               頥 祭.

               㭪 rmdir 頥 祭 0, ᫨ ४਩ ᯥ-
          㤠. 頥 祭 -1 ᢨ⥫  訡   
         errno ⠭    ᫥ 祭:

               祭                        

         EACCES                path-    ४-
                              ਥ;  ४਩  ,    -
                              ४਩  ⥪騬 ࠡ稬   -
                              ४ਥ   ४ਥ .

         ENOENT               Path-  


               .⠪ chdir, mkdir.

               ਬ:

            #include <direct.h>

            int result1, result2;

               /*  ᫥騥    㤠  ४: **  
         ୥, 㣮 -  ⥪饬 ࠡ祬 ** ४ਨ */

            result1=rmdir("/data1");
            result2=rmdir("data2");


               RMTMP

            #include <stdio.h>


            int rmtmp;

               ᠭ.

               㭪  rmtmp ᯮ  ⪨  ६ 䠩-
           ⥪饬 ४ਨ.  㭪 頥    㤠  ⮫쪮
         䠩, ᮧ   tmpfile.
               㭪  rmtmp  ᯮ짮  ⮬  ᠬ ४-
         ਨ,  ᮧ ६ 䠩.

               頥 祭.

                㭪 頥 ⢮ 饭   㭨⮦
         ६ 䠩.
               . ⠪ flushall, tmpfile, tmpnam.

               ਬ:

            #include <stdio.h>

            main ()

                 {
                  int numdeleted;
                  .
                  .
                  .
                  if ((stream = tmpfile()) == NULL)
                     perror ("Couldn't open new temporary file");
                  .
                  .
                  .
                  numdeleted = rmtmp;
                  printf ("Number of files closed and deleted in\
                  current directory = %d\n", numdeleted);
                 }.



               SBRK

            #include <malloc.h>    ॡ ⮫쪮  
                                   㭪樨

            char *sbrk(incr);
            int incr;              ⢮   塞    
                                   ⠥  ⮢

               ᠭ.

               㭪 sbrk ⠭ 祭 ࠧ뢠  맢-
           .  祭  ࠧ뢠    ࢮ 
         墠祭 . 㭪 sbrk  incr    祭
         ࠧ뢠;  ᮮ⢥⢥ ⮬ ⠭ ࠧ 墠뢠-

          .

               砭. Incr   ⥫, ⮣  ⢮
         墠祭  㬥蠥  incr ⮢.

               頥 祭.

               㭪 sbrk 頥 ஥ 祭 ࠧ뢠. 頥-
           祭  -1  㪠뢠  訡   errno ⠭ 
         ENOMEN, 㪠뢠,  ⠫ 筮 .
               .⠪ calloc, free, malloc, realloc.

               砭.  ⭮, 让    huge-  ணࠬ
         㭪  sbrk   頥 祭 -1.   -
          ணࠬ  墠 ᯮ 㭪 malloc.


               ਬ:

            #include <malloc.h>
            #include <stdio.h>

            /* 墠뢠   100  */

            char *alloc;
            alloc=sbrk(100);
            .
            .
            .

            /* 㬥蠥 墠祭   60   */

            if (alloc != (char)-1)
                   sbrk(-40);


               SCANF

            #include <stdio.h>

            int scanf(format-string[[, argument...]]);
            char *format-string.       ப ࠢ ଠ⮬.

               ᠭ.

               㭪 scanf ⠥   ⠭⭮ ⮪ stdin  
         , ।塞 㬥⠬ arguments.  㬥 
           㪠⥫  祭  ⨯,  ᮮ⢥ ⨯,
           ப ଠ. ப ଠ ࠢ ८ࠧ-
         ﬨ  .  ப  ᮤঠ ᫥饥:

               "஡" ᨬ, .. ᨬ ஡ ' ', ⠡樨 \t,
          ப '\n'.  㭪樨 scanf ᨬ ஡ ।-
          뢠,   ,   ᫥ ᨬ-
          ஡   ࢮ ᨬ,  饣 ஡.

             ᨬ ஡  ப ଠ ᮮ⢥ -
          ,  0,   樨 ᨬ ஡.
                ᨬ ࠢ,  騩 ஡   ᨬ
           業 %.   ⮬ ᨬ  㭪樨 scanf -
          뢠,    ᮮ⢥  ᨬ
         ࠢ. ᫨ ᫥騩 ᨬ  <stdin>  ᮮ⢥ ᨬ-
          ࠢ,  scanf 稢 ᢮ ࠡ.
               䨪  ଠ,    %.  ⮬ 砥
         scanf ⠥  ८ࠧ뢠  ᨬ  祭  -
          ⨯, 祬 祭 । ᮮ⢥騬 -
         ⠬  ᯨ᪠ 㬥⮢.

               ப ଠ ⠥ ᫥ ࠢ.   ᯥ-
         樨 ଠ । ᮣᮢ묨  ᫥⥫쭮
         ᨬ  ⮪ stdin;  ᮣᮢ ᨬ  stdin ᪠-
         ,      .  ᫨  ᨬ  stdin ⨢
         ப ଠ, scanf 稢 ᢮ ࠡ.   䫨騩
         ᨬ ⠥  stdin, ⠪      ⠭. 
         砥  ࢠ  ᯥ䨪 ଠ, ⮣ 祭 ࢮ
           ८ࠧ뢠  ᮮ⢥⢨  ᯥ䨪樥 -
             ,   㬥⮬.   -
         ன  ᯥ䨪樨 ଠ 믮 ८ࠧ ண 
              ஬  㬥;    ⠪    
         ப ଠ.
                  ࠭稢  "஡" ᨬ 
          ᨬ,     ८ࠧ    
         ଠ,  砥 ⨦  width, ஥  .
               ᫨  ࠭ ᯥ䨪樨 ଠ   -
         ⮢, 祬 ॡ,  譨 㬥 .
               䨪 ଠ  ᫥ .

               %<flags><wigth><.precision><{F:N:h:I}><type>.

                   ଠ ᯥ䨪権  ⤥ ᨬ-
           ᫮,  ࠦ騬  ⤥    ଠ.  
         type, 騩 ᫥ ᫥ 易⥫쭮  ଠ,
         । ⨯    ᨬ쭮, ப  ᫥-
         .
               ⥩訩 ଠ ᯥ䨪樨 ᮤন ⮫쪮 ᨬ 
         業  ᨬ ⨯ (ਬ, %S).
                 ᯥ䨪樨 ଠ 뢠 .
               ᫨      業  % ᫥ ᨬ,  騩
         ᨬ ࠢ ଠ⮬,   ᨬ  騥   ᨬ-
         ,   ᫥饣  %, ࠪ  筠 ᫥-
         ⥫쭮 ᨬ, .. ᫥⥫쭮,    
          . ਬ, ⮡  ᨬ  %, ᯮ
          %%.
               窠  (*),       %,  祭
         ᫥饣  , 饣  ,  ।塞  ⨯
         type.   ᪠,   .
               Widht    ⥫  楫  ࠢ
         ᨬ쭮  ᫮ ᨬ, 뢠  stdin. -
         ࠧ뢠    ᮮ⢥饬 㬥 ⮫-
           ᨬ,   ॢ width. ᫨  width  -
           "஡"  ᨬ,  .. ᨬ ஡, ⠡樨 

          ப,   ࠭ ଠ    ८ࠧ뢠,
           㤥 ⨣ ࠧ width.
               易⥫  䨪  F    N   뢠 ਭ⮥ 
         㬮砭 ᭮ ᮣ襭 ᯮ㥬  . F  -
            䨪ᮬ  㬥 argument, 㪠뢠饬  far--
         ;  N -  near-ꥪ.
               易⥫ 䨪 l ᢨ⥫  ⮬,  ᯮ-
           long;  䨪 h - 㪠뢠  ᯮ짮 -
         ᨨ  short.  ⢥騩  argument  㪠뢠    long   
         double-ꥪ  (   䨪 l)    short-ꥪ (
          䨪 h). 䨪 l  h  ᯮ짮 -
           ⨯ ᨬ d, i, o, x, u. 䨪 l ⠪  -
         짮  ᨬ type e  f. ᫨ ।   㣮
         type, 䨪 l  h .

                type   祭 ᠭ  ⠡ R.4.

                                                         R.4

                            ᨬ 㭪樨 scanf

                          
                           


              d          楫     㪠⥫   int.

              D          楫     㪠⥫   long.

              o       쬥 楫     㪠⥫   int.

              O       쬥 楫     㪠⥫   long.

              x       ⭠      㪠⥫   int.
                      楫

              X       ⭠      㪠⥫   long.
                      楫

              i       ,  -     㪠⥫   int.
                        -
                        -
                      

              I       ,  -     㪠⥫   long.
                        -
                        -
                      

              u         -     㪠⥫  unsigned
                        楫          int.

              U         -     㪠⥫  unsigned
                        楫          long.


              e       祭   -     㪠⥫   float
              f       饩  窮,  -
                      ঠ饥  易-
                      ⥫  ("+",
                      "-"),      
                        
                      , 筮  -
                      ঠ  -
                         ᯮ-
                       ("", ""),
                          -
                        
                      楫   祭.

              c       ᨬ. -     㪠⥫   char
                       ஡,  ⠡-
                      樨     
                      ப, ⠪  -
                       "஡
                      ᨬ",  
                      筮  ய᪠-
                      ,     
                      ⮣ ⨯  -
                      .  -
                         ᫥饣
                      ᨬ,  -
                      饣   "஡-
                      ", ᯮ
                       %1s.

              s       ப.             㪠⥫  ᨬ-
                                              ᨢ, -
                                              让  -
                                                  
                                             㫥     ᨬ
                                             砭 '\0',  -
                                             騬 ⮬-
                                             ᪨.

              n       ⥭         㪠⥫   int, 
                         stream         ஬ 뢠
                          ந-     ᫮  ᯥ譮  -
                      室.                 ⠭  ᨬ  
                                             ⮪    ,
                                                㪠
                                              맮 scanf.

              p       祭    ଥ     㪠⥫     far-
                      xxxx : yyyy,        㯯 .
                       x  y  -
                        ⭠-
                      묨    ࠬ
                      孥 ॣ.



                 ⥭  ப,  ࠭祭 ᨬ ஡, -
         ⢮ ᨬ   ᪮ []   ப-
          ⨯ s. ⢥饥   ⠥   ࢮ-
          ᨬ,  ᮤঠ饣  ࠭祭 묨  ᪮
         ⢥ ᨬ. ᫨  ⮬ ⢥  ᨬ -
           caret  (^),  १ ࠭:   뢠 
         ࢮ ᨬ,  室饣   ⢮ ᨬ. ⮡ -
          ப  㫥 ᨬ '\0', ਬ  ᯥ䨪-
          %nc,  n - 筮 楫.  ⮬ 砥 ᨬ ⨯ s
         ।  㬥,   㪠뢠  ᨢ ᨬ. -
         騥  n  ᨬ 뢠  室 ⮪  ।
         ⮯   㫥 ᨬ  뢠.
               㭪 scanf      ᪠  ᨬ  
         ᨬ.     ⥭ ⤥쭮   ⨦-
          ᨬ ஡, ᫨  ⨣  width;  ᫥-
         騩  ᨬ    ८ࠧ   -
         ;  ᫥騩 ᨬ  䫨    ᮮ⢥騬  
         ᨬ    ࠢ饩 ப ଠ;   ᫥騩 ᨬ
           ࠭ ⢥ ᨬ.  ந室  -
         㦤    砭 뢠,  ᫥饥  
         ᬠਢ  ᠬ  ࢮ  䫨饣  ᨬ.  
         ᨬ, ᫨  , ᬠਢ  ⠭,  
           ᨬ  ᫥饣    ,    ᨬ 
         ᫥  ⥭ ⮪ stdin.

               頥 祭.

                㭪 頥 ᫮ ᯥ譮 ८ࠧ  -
         祭 .  頥 祭  ᮤন ᫮  -
         ⠭      祭 .  ⪥ 뢠 
         䠩 頥 祭 EOF. 頥 祭 0 㪠뢠-
         ,   祭 .
               .  ⠪  fscanf,  printf,  sscanf,  vfprintf,   vprintf,
         vsprintf.

               ਬ 1.

            #include <stdio.h>

            int i;
            float fp;
            char c, s[81];

            scanf("%d  %f  %c  %s", &i, &fp, &c, s);
            /*  ࠧ  */.

            ਬ 2.

            #include <stdio.h>

            main ()          /* ८ࠧ ⭠筮
                             **   쬥筮   楫     
                             ** 筮 楫  */
            {
            int numassigned, val;


            pintf("Enter hexadecimal or octal #, or 00
                   to guit:\n");
            do
               {  printf("# = ");
                  numassigned = scanf("%i", &val);
                  printf("Decimal # = %i\n", nal);
               }
            while (val && numassigned);

               /*    横,  ᫨  祭   ࠢ 00,  ᫨
         scanf  ᯮᮡ   */.

            }

                 室 㤥 ᫥饥.

            Enter hexadecimal or octal #, or 00 to guit:

            # = 0xf
            Decimal # = 15

            # = 0100

            Decimal # = 64

            # = 00

            Decimal # = 0.



               SEGREAD

            #include <dos.h>

            void segread (segregs);
            struct SREGS *segregs;    祭 ॣ஢ ᥣ

               ᠭ.

               㭪  segread   ,   㪠뢠
         segregs, ⥪騬 ᮤন ॣ஢ ᥣ.  㭪 
         ᯮ짮   㭪ﬨ intdosx  int86, ⮡  -
          祭 ॣ஢ ᥣ⮢, ᯮ㥬 ᫥.

               頥 祭.

               頥 祭 .
               .⠪ intdosx, int86x, FP_SEG.

               ਬ:

            #include <dos.h>


            struct SREGS segregs;
            unsigned int cs, ds, es, ss;

               /* ᫥騥    ⥪騥  祭  ॣ஢
         ᥣ */

            segread(&segregs);
            cs=segregs.cs;
            ds=segregs.ds;
            es=segregs.es;
            ss=segregs.ss;



            SETBUF

            #include <stdio.h>

            void setbuf(stream, buffer);
            FILE *stream;        㪠⥫   FILE
            char *buffer;        , ࠧ頥 짮⥫.

               ᠭ.

               㭪 setbuf  짮⥫ ࠢ ਧ-
           ⮪  stream.  㬥  stream  뫠  
         䠩. ᫨ 㬥 buffer  NULL,  stream   ਧ-
         ;  ᫨  ⮪ ਧ,  buffer  㪠뢠 
         ᨢ ᨬ  ࠧ஬ BUFSIZ,  ࠧ BUFSIZ  ।  
         <stdio.h>. 짮⥫  ᯮ짮  buffer  -
         ਧ樨  /뢮    ,  ࠧ頥  ⥬ 
         㬮砭  ⮪ stream.
               ⠭ ⮪ stderr  stdaux  㬮砭  
         ਧ묨,   ᯮ짮 㭪樨 setbuf     
          .

               頥 祭.

                ⮩ 㭪樨 頥 祭 .
               . ⠪ fflush, fopen, fclose.

               ਬ:

            #include <stdio.h>

            char buf[BUFSIZ];
            FILE *stream1, stream2;

            stream1 = fopen("data1", "r");
            stream2 = fopen("data2", "w");

            setbuf(stream, buf);
         /* stream1 ᯮ , 祭 짮⥫ */
            setbuf(stream, NULL);
         /* stream2  ਧ */.




               SETJMP

            #include<setjmp.h>

            int setjmp(env);
            jmp_buf env;                   ६,   ன
                                           ࠭ 㦥.

               ᠭ.

               㭪  setjmp  ࠭  ﭨ  ⥪,  
          ᫥⥫쭮 ⠭ ।⢮ ᯮ짮 㭪-
         樨 longjmp.
               㭪樨 setjmp  longjmp ᯥ稢   믮-
           쭮  (nonlocal)  室  筮 ᯮ 
         । ࠢ  ࠡ⪥ 訡   ⠭  
         ࠭ 맢 楤 (  ᯮ짮  筮  맮),
           ᫮ 祭. 맮 setjmp ⨢ -
         ࠭ ⥪饣 ﭨ ⥪  env. ᫥騩 맮 longjmp
         ⠭  ࠭ ﭨ  頥 ࠢ 
         㪠⥫ ( 室), ।⢥ ᫥騩   ᮮ⢥-
         騬 맮 setjmp.  뢠 㭪 longjmp, 祭
           ६  ( ᪫祭 ६ ॣ) ⠭
         㯭묨  楤,  ਭ ࠢ  ᮤন
         祭  ६. 祭 ६ ॣ ।᪠-
         㥬.

               頥 祭.

               ᫥ ࠭ ﭨ ⥪ 㭪 setjmp  頥
         祭 0. ᫨  १ 맮 longjmp 頥 setjmp,
         ⮣ 頥  祭 value 㬥 longjmp. 頥-
          祭  砥 訡 .
               . ⠪ longjmp.

               砭. ᫥ 믮 longjmp 祭 ६ -
           楤, 뢠饩 setjmp,    ⠭-
          (饭)  ᮡ⢥ 祭.


               ਬ:

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

            jmp_buf mark;

            main()
                 {
                 if (setjmp(mark) != 0)

                 {   printf("longjmp has been called\n");

                     recover();
                     exit(1);
                  }
                 printf("setjmp has been called\n");
                 .
                 .
                 .
                 p();
                 .
                 .
                 .
                 }


                p()
                {

                int error = 0;
                .
                .
                .
                if (error != 0)
                   longjmp(mark, -1);
                .
                .
                .
                }

                recover()
                {

               /*    室  ணࠬ 㡥,  䠩  
          祭 */

                .
                .
                .
                }.




               SETMODE

            #include <fcntl.h>
            #include <io.h>    ॡ ⮫쪮  
                               㭪樨

            int setmode(handle,mode);
            int handle;        䠩 handle
            int mode;           ० ८ࠧ

               ᠭ.

               㭪 setmode ⠭  mode  ०  ८ࠧ

         䠩,   handle.
               Mode     ᫥ ⠭.

         Manifest-⠭                 祭

          O_TEXT           ⠭  ⥪⮢  ०  -
                           ࠧ.  " -
                            - ॢ ப"  ८ࠧ  
                           室   ᨬ "ॢ ப"
                           ().    뢮 ८ࠧ
                             " ⪨ - ॢ
                           ப".

         O_BINARY          ⠭    ०.   
                           襯ਢ ८ࠧ   -
                           ন.

               㭪  setmode 筮 ᯮ  䨪樨 ०
         ८ࠧ, ⠭  㬮砭,  stdin, stdout,
         stderr, stdaux, stdprn,   ᯮ짮   䠩.

               頥 祭.

                砥 ୮ ⠭ 㭪 setmode 頥 ।-
         騩 ० ८ࠧ. 頥 祭 -1 㪠뢠 
         訡   errno ⠭    ᫥ 祭:


          祭                       

          EBADF                 䠩 handle.

          EINVAL                㬥 mode. ( O_TEXT,  
                               O_BINARY).

               .⠪ create, fopen, open.


               ਬ:

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

            int result;

               /* ᫥騩  ⠭ stdin  ०  ८-
          binary (ࢮ砫쭮   text) */

            result = setmode(fileno(stdin), O_BINARY);




               SETVBUF


            #include <stdio.h>

            int setvbuf(stream, buf, type, size);

            FILE *stream;      㪠⥫   FILE
            char *buf;         , 祭 짮⥫.
            int type           ⨯ :
                                   _IONBF -  ;
                                   _IOFBF -  ਧ;
                                   _IOLBF - ப ਧ.
            int size;          ࠧ .

               ᠭ.

               㭪  setvbuf  짮⥫ ࠢ ਧ-
         樥  ࠧ஬   ⮪ stream. Stream   뫠
            䠩. ᨢ,   㪠뢠 buf, ᯮ
          , ᫨    NULL, .. ⮪   -
         ਧ. ᫨ ⮪ ਧ, ᯮ ⨯,  ।-
           type;  ⨯    _IONBF,  _IOFBF, -
           _IOLBF. ᫨ ᯮ ⨯ _IOFBF, ࠧ  ।-
           size; ᫨ ᯮ ⨯ _IOLBF  _IONBF, ⮪  -
          ਧ,  size  buf .

                            

            _IONBF               ᯮ, ᬮ  
                               ⢨ size  buf

            _IOFBF              ਧ, ᫨ buf  -
                                 NULL;  ⮬  buf ᯮ-
                                 ⢥ ,   size -
                                ࠧ

            _IOLBF             筮 _IOFBF

               ⨭  祭  size  筮  0,   -
         쭮 楫 ࠧ.

               頥 祭.

                㭪 頥 㫥  祭,  ᫨  ⨯  
         ࠧ  ࠢ쭮 ।,  頥 祭 0, -
           । ୮.
               . ⠪ setbuf, fflush, fopen, fclose.


               ਬ:

            #include <stdio.h>

            char buf[1024];

            FILE *stream1, *stream2;


            main()

            {
            stream1 = fopen("data1", "r");
            stream2 = fopen("data2", "w");

               /*  Stream1  㤥 ᯮ짮  ࠧ஬ 1024  
         祭 짮⥫,  stream2  ਧ */

            if (setvbuf(stream1, buf, _IOFBF, sizeof(buf)) !=0)
                  printf("Incorrect type or size of buffer1\n");
            if (setvbuf(stream2, _IONBF, 0) != 0)
                  printf("Incorrect type or size of buffer2\n");
            }.


               SIGNAL

            #include <signal.h>

            int (*signal(sig, func)();
            int sig;                           祭 ᨣ
            int (*func)();                     믮塞 㭪

               ᠭ.

               㭪 signal      樮  ⥬
             ᯮᮡ ࠡ⪨ ᨣ 뢠. 㬥 sig
              ⠭ SIGINT  SIGFPE, -
           <signal.h>. ⭠ ⠭ SIGINT  ᮮ⢥
           MS DOS ᨣ 뢠 INT 23H. SIGFPE ᮮ⢥ -
          饩 窨,   ᪨஢, ⠪    -
         ,   , ୠ . 㬥 func 
             ⠭ SIG_DFL  SIG_IGN (⠪ -
         ।  <signal.h>),  ᮬ 㭪樨.  祭 ᨣ-
           뢠  ਭ ⢨   祭 func 
          ᫥騬:

                                     

         SIG_IGN              뢠  .  
                           祭  SIGFPE  ,   ..
                           ﭨ     饩 窮
                           ⠥ ।.

         SIG_DFL           맢  襭;  ࠢ
                           ।     ஢  MS DOS.
                            䠩,   ,  -
                           ,    .

          㭪樨      ᨣ SIGINT 㭪樨,  
                           㪠뢠 func,  ।    㬥
                           SIGINT   믮. ᫨  㭪
                           蠥 ଠ쭮, ࢠ  -
                             믮  ,

                           ᫥饩  ⮩,  ன  祭
                           ᨣ  뢠.  ।  믮
                           ᯥ஢ 㭪樨 祭 func
                           ⠭    SIG_DFL;  ᫥騩
                           ᨣ 뢠 ࠪ    
                           SIG_DFL,  ᫨  譨  맮  signal,
                           騩 㣮 祭 뢠, 
                           ।.     짮⥫
                           ⠭ ᨣ   뢠
                           㭪, ᫨ 室.    SIGFPE
                           㭪,       㪠뢠 func,
                           ।  㬥 - SIGFPE  -
                             訡,  FPE-xxx-,    ⥬
                            믮. ( include-䠩
                           <float.h>      ।  
                           FPE-xxx.)     祭     func      
                           ⠭      ,   
                           㤥  祭  ᨣ 뢠;  
                           室    ﭨ  饩  窨
                           ᯮ  setjmp     longjmp
                           (. ਬ   㭪樨_fprset).  ᫨
                           㭪 蠥 ଠ쭮, ࢠ-
                                         
                           ।    ﭨ   饩
                           窨.


               頥 祭.

               㭪 signal 頥 ।饥 祭 func. -
         頥 祭 -1 ᢨ⥫  訡  errno ⠭-
           EINVAL, । ୮ 祭 sig.
               .⠪ abort, exit,  _exit,  _fpreset,  spawnl,  spawnle,
         spawnlp, spawnv, spawnve, spawnvp.

               砭:   child-,  ᮧ ।-
           맮 楤 exec  spawn, ⠭ ᨣ -
           ࠭.  ᨣ  child- ⠭-
           㬮砭.

               ਬ:

            #include <stdio.h>
            #include <signal.h>
            #include <stdlib.h>
            #include <process.h>
            int handler();

            main()
                  {
                  if(signal(SIGINT, handler)==(int(*)())-1) {
                      fprintf(stderr,"couldn't set SIGINT\n");
                      abort();
                      }
                      .

                      .
                      .
                  }

            int handler()
                  {
                  char ch;
                  printf("terminate processing? ");

                  scanf("%1c", &ch);
                  if (ch=='y' ::ch=='Y')
                        exit(0);
                  signal(SIGINT, handler);
                  }

               /* 㭪 signal, 맢    ᫥饣  ᨣ
         뢠, 뫠 ࠢ   ,   handler() */



               SIN-SINH

            #include <math.h>

            double sin(x);          ᨭ x
            double sinh(x);         ࡮᪨ ᨭ
                                   x
            double x;              ࠤ

               ᠭ.

               㭪樨  sin  sinh  ᮮ⢥⢥ ᨭ  -
         ᪨ ᨭ x.

               頥 祭.

               㭪 sin 頥 ᨭ x. ᫨ x  让,    
           筠  稬 १.  ⮬ 砥
         sin ࠡ뢠 訡 PLOSS,  ᮮ饭  ⠥.  ᫨  x
         ⮫쪮 让,    稬 १, ⮣-
           sin  ⠥ ᮮ饭  訡 TLOSS  stderr  頥
         0.    errno ⠭  ERANGE.
               㭪 sinh 頥 ࡮᪨ ᨭ x.  ᫨  -
          让, sinh 頥 祭 HUGE (⥫쭮 
         ⥫쭮,  ᨬ   x)   ⠭
         errno  ERANGE.
               aa  訡     ஢aa  
         楤 matherr.
               .⠪ acos, asin, atan, atan2, cos, cosh, tan, tanh.

               ਬ:

            #include <math.h>

            double pi = 3.1415926535,x,y;


            x = pi/2;);
            y = sin(x);  /* y ࠢ 1.0 */

            y = sinh(x); /* y ࠢ 2.3 */



               SOPEN

            #include <fentl.h>
            #include <sys\types.h>
            #include <sys\stat.h>
            #include <sharc.h>
            #include <io.h>        ॡ ⮫쪮  
                                   㭪樨

            int sopen(pathname,oflag,shflag{,pmode]);
            char *pathname;        path-  䠩
            int oflag;             ⨯ ࠧ襭 権
            int shflag;            ࠧ襭 ⨯ ࠧ
            int pmode;             ࠧ襭 ⨯ 㯠

               ᠭ.

               㭪 sopen 뢠 䠩,      path-,  
         ⠢   ᫥饬 ࠧ ⥭  ,
          । 祭 oflag  shflag. Oflag  楫
         ࠦ,  騬  樨   ᪮쪨 ᫥-
           ⠭,   <fcntl.h>.    
           祬  ⭠ ⠭, ⮣  ꥤ 
           (:).

            OFLAG                          

            O_APPEND        ।       樥     
                            ६頥 㪠    䠩   
                            䠩.

            O_CREAT          䠩 ᮧ    ;
                                䥪⨢,  ᫨  
                            䠩, ।塞  path-.

            O_EXCL          頥  祭  訡,   ᫨
                             䠩, ।塞  path-
                            . ᯮ   O_CREATE.

            O_RDONLY            ⮫쪮   ⥭, ᫨
                              䫠, ⠪    -
                            ࠭ 䫠 O_RDWR  O_WRONLY.

            O_RDWR            ६  ⥭  
                            ; ᫨      䫠, 
                              ࠭ 䫠
                            O_RDONLY    O_WRONLY.


            O_TRUNC         騩  䠩     祭 
                             0;  䠩   ࠧ-
                            襭    .   ন  䠩
                            㭨⮦.

            O_WRONLY            ⮫쪮   ⥭; ᫨
                               䫠,      
                            䫠 O_RDONLY  O_RDWR.

            O_BINARY           筮  ( ࠭᫨-
                            ) ०.  (. ᠭ  -
                             ०  㭪樨  fopen).

            O_TEXT             ⥪⮢ (࠭᫨஢-
                            ) ०.   (.  ᠭ  ⥪-
                             ०  㭪樨 fopen).

               砭:  O_TRUNC  㭨⮦ ᮤন -
         饣 䠩, ⮬ 㦭 ⥫쭮 ᯮ짮    -
         ⠭.
               㬥  shflag  ⠭ ࠦ, 騬
          ᫥  ⠭,   <share.h>.  -
         ஡  ଠ   ० ࠧ ਢ 
         㪮⢥  MS DOS.

            shflag                          祭

           SH_COMPAT        ⠭ ० ᮢ⨬

           SH_DENYRW          ⥭     䠩  
                            ࠧ襭

           SH_DENYWR            䠩  ࠧ襭

           SH_DENYRD          ⥭  䠩  ࠧ襭

           SH_DENYNO          ⥭   ࠧ襭


               㬥 pmode ॡ  ⮫쪮  ⮣,    ।
         ⠭ 0_CREAT. ᫨ 䠩  , pmode ⠪ ।-
           ⨯ 㯠  䠩,  ⠭  ६ -
            䠩.  ⨢ 砥 㬥 pmode -
         . 㬥 pmode  楫 ࠦ,  ᮤঠ騬
               ⠭ S_IWRITE  S_IREAD, -
           <sys\stat.h>.    ⠭,  ꥤ-
          ஬ (!). 祭 㬥 pmode ਢ .

                          

            S_IWRITE             ࠧ蠥 

            S_IREAD              ࠧ蠥 ⥭


            S_IREAD:S_IWRITE     ࠧ ⥭  

               ᫨   ࠧ襭, 䠩 ।祭 ⮫쪮  -
         .   MS DOS  䠩   ⥭, ࠧ襭  
          . ⮬  S_IWRITE  S_IREAD: S_IWRITE 
         묨.
               ।  ⠭ ࠧ襭 㭪 sopen ਪ뢠 -
           䠩  pmode (. umask).

               頥 祭.

               㭪 sopen 頥 handle-   䠩. -
         頥 祭 -1 㪠뢠  訡; errno  ⠭  
           ᫥ 祭:

                             

            EACCES          path-  ४ਥ
                            ᤥ ⪠      䠩,
                              ⮫쪮      ⥭,   
                            襭  ० ࠧ.
                           (ᨨ MS DOS 3.0  ).

            EINVAL          䠩 SHARE.COM  ⮫-
                           .

            EEXIST          O_CREAT  O_EXCL  ।,  
                            䠩 ᥣ .

            EMFILE         㣨 handle-  䠩     㯭,
                           ..   䠩.

            ENOENT           path-  .

               .⠪ close, create, fopen, open, umask.

               砭:  㭪 sopen ᯮ   3.0 MS DOS
          .  ࠭  MS DOS 㬥 shflag .
                ࠧ 䠩 ࠡ ୮  ਧ묨
         䠩, ⮬ fdopen  ᯮ  裡 ⮪  䠩,
         ⮣  ࠧ  .

               ਬ:

            #include <fcntl.h>
            #include<sys\types.h>
            #include<sys\stat.h>
            #include<share.h>
            #include<io.h>

            extern unsigned char _osmajor;
            int fh;


               /* । 맮 sopen ᯮ ६ _osmajor 

         ஢ન  ᨨ MS DOS . */.

            if (_osmajor >=3)
               fh = sopen ("data", O_RDWR:O_BINARY, SH_DENYRW);

            else
               fh = open ("data", O_RDWR: O_BINARY);


               SPAWNL-SPAWNVPE

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

         int spawnl(modeflag,pathname,arg0,arg1...,argn,NULL);
         int spawnle(modeflag,pathname,arg0,arg1...,argn,NULL,envp);
         int spawnlp(modeflag,pathname,arg0,arg1...,argn,NULL);
         int spawnlpe(modeflag,pathname,arg0,arg1...,argn,NULL,envp);
         int spawnv(modeflag,pathname,argv);
         int spawnve(modeflag,pathname,argv,envp);
         int spawnvp(modeflag,pathname,argv);
         int spawnvpe(modeflag,pathname,argv,envp);

         int modeflag;               ० 믮 parent-
         char *pathname;             path- 믮塞 䠩
         char *arg0,*arg1...,*argn;  ᯨ᮪ 㪠⥫  㬥
         char *argv[];               ᨢ 㪠⥫  㬥
         char *envp[];               ᨢ 㪠⥫  ⠭-
                                      㦥

               ᠭ.

               㭪樨  spawn ᮧ  믮  child-. 
         㧪  믮 child-   㯭  -
         筮  .  㬥 modeflag । ⢨, 롨ࠥ
         parent-ᮬ ।   殮 spawn. 騥  祭
         modeflag   <process.h>

         祭                         

         P_WAIT               ਮ⠭  parent-,  
                                child-.

         P_NOWAIT             த  믮  parent-,
                              ࠫ쭮  child-ᮬ.

         P_OVERLAY            Parent-  ४뢠   child-
                              ᮬ; parent-  㭨⮦
                              (  ⢨,    맮 exec)

                 ᯮ짮  ⮫쪮  祭 modeflag, ⠪ 
         P_WAIT  P_OVERLAY. 祭 P_NOWAIT ࠭    
         饩 ॠ樨. ᫨ ᯮ P_NOWAIT, 頥 -
         祭  訡. 㬥 pathname । 䠩, 믮塞 
         child-. Pathname  ।  path (  ),
          path ( ⥪饣 ࠡ祣 ४),    䠩-
         .




               ᫨  pathname   ७   䠩  ᫨
           稢 窮 (.), ⮣ 㭪 spawn ⠭-
          ७ .EXE. ᫨ pathname  ७,   ᯮ-
           ⮫쪮   ७. ᫨ pathname 稢 窮,
         spawn  ⢫    pathname    ७.  楤
         execlp, execlpe, execvpe ⢫   pathname (ᯮ-
            楤)  ४, । ६ -
          PATH.
               㬥       ।  㬥 
         맮 spawn,       㪠⥫    ᨬ
         ப.    ᨬ  ப  ࠧ  ᯨ᮪ 㬥⮢ 
         child-.   ப, ࠧ  ᯨ᮪  㬥⮢
            ,   ॢ 128 ⮢. 㫥 ᨬ-
          砭 '\0'  ப     뢠,
          ᨬ ஡ (⮬᪨ ⠢塞  㬥⮢)--
         뢠.
               ⥫ 㬥⮢  ।  ⤥ -
          ( execl, execle, execlp, execlpe)   ᨢ  㪠-
           ( execv, execve, execvp, execvpe).  ࠩ   -
         㬥 - arg0  argv[0] -  ।   child-.
           ᫮    㬥     㬥 pathname.
         (㣮 祭 訡  ࠡ뢠).      MS  DOS,
         ࠭  3.0, । 祭 arg0  argv[0]  㯭
          ᯮ짮  child-. ,  ᨩ MS DOS 3.0
           pathname 㯭 १ arg0  argv[0].
               맮  execl,  execle, execlp, execlpe 筮 ᯮ
         ⮣,  ⢮  㬥⮢  ⭮  ࠭.  㬥
         arg0 筮  㪠⥫  pathname. 㬥  arg1 
         argn   㪠⥫ﬨ  ᨬ ப, ࠧ騥 
         ᯨ᮪ 㬥⮢. NULL-㪠⥫, 騩  㬥⮬ argn, -
         ।  ᯨ᪠ 㬥⮢.
               맮 execv, execve, execvp, execvpe  ᯮ,  
         ᫮  㬥⮢     ६. -
         ⥫  㬥 뫠  ᨢ argv. 㬥  argv[0]
         筮    㪠⥫  pathname. 㬥  argv[1] 
         argv[n]  㪠⥫ﬨ  ᨬ ப, ࠧ騥 -
          ᯨ᮪ 㬥⮢. 㬥 argv[n+1]    NULL-㪠-
         ⥫  ।  ᯨ᪠ 㬥⮢.
               ,    맮 spawn,  묨  -
          .  맮 execl, execlp, execv, execvp,  child--
          ᫥ 㦥 parent-. 맮 execle, execlpe,
         execve,  execvpe    짮⥫   㦥 
         child-, । ᯨ᮪ ⠭  㦥  १
         㬥 envp.
               㬥 envp  ᨢ ᨬ 㪠⥫, -
             ண  (᪫ ᫥ ) 㪠뢠 
         ப, 稢 㫥  ।  ६  㦥-
         . 筮  ப  :
               NAME = value,
                NAME -  ६ 㦥, value - 祭 -
         ,  ன ⠭  ६. (⨬,  value
          砥  窨 "..."). ᫥ ⮬ ᨢ envp
           NULL.
               Child- ᫥ ⠭ 㦥 parent--
         ,  envp  NULL.



               頥 祭.

               頥   祭      ᮬ   室   
         child-.  室 ࠢ 0, ᫨  ଠ쭮 -
         襭.  室 ⠭  㫥 祭,  ᫨
         child- ᮡ ࠧ 뢠 楤 exit   -
         㫥  㬥⮬.  ᫨   ⠭,  ⥫
          室 㪠뢠  । 室  ணࠬ -
         ।⢮ abort  뢠.
               頥  祭   -1   ᢨ⥫      訡
         (child-    ⮢),  errno ⠭   
         ᫥ 祭:

                                   

         E2BIG                ᮪ 㬥⮢  ॢ蠥  128  
                                  ⢮,    ॡ㥬    
                              ଠ樨 㦥,  ॢ蠥 32.

         EINVAL               㬥 modeflag .

         ENOENT                 path-  .

         ENOEXEC              । 䠩   믮
                                 ଠ.

         ENOMEN               筠      㯭   
                              믮 child-.

               砭! 맮 spawn  ࠭  ०  ८ࠧ
           䠩. ᫨ child- ᯮ 䠩, 㭠᫥-
            parent-, ⮣ 楤 setmode ਬ
          ⠭ ॡ㥬 ० ८ࠧ   䠩.
                child-, ᮧ 맮 楤  spawn,  ᨣ-
           ⠭  ࠭.  child-  -
           㬮砭.

               C. ⠪ abort, execl,  execle,  execlp,  execlpe,  execv,
         execve, execvp, execvpe, exit, _exit, onexit, system.

               ਬ.

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

               extern char **environ;

               char *args[4];
               int result;

               args[0]="child";
               args[1]="one";
               args[2]="two";

               args[3]=NULL;
               .
               .
               .
               /*    ᫥騥     ஦ ,
          "child.exe",  ।   㬥.  
         㬥 ਮ⠭ parent-,  ᫥  - -
         뢠 parent-  child */.

               result=spawnl(P_WAIT,"child.exe","child","one","two",
                   NULL);
               result=spawnle(P_WAIT,"child.exe","child","one",
                   "two", NULL, environ);
               result=spawnlp(P_WAIT, "child.exe","child","one",
                   "two", NULL);
               result=spawnv(P_OVERLAY, "child.exe", args);
               result=spawnve(P_OVERLAY, "child.exe", args, environ);
               result=spawnvp(P_OVERLAY, "child.exe", args);


               SPRINTF

               #include <stdio.h>

               int sprintf(buffer, format-string[, argument...]);
               char *buffer;                 ࠭ 뢮
               char *format-string;       ப  ࠢ ଠ⮬

               ᠭ.

               㭪 sprintf ଠ    ᨬ  
         祭   buffer.  㬥 argument (᫨  ), -
         ࠧ  뢮 ᮣ᭮ ᮮ⢥饩 ᯥ䨪樨 -
           format-string.
               Format-string ⮨  浪 ᨬ     
         ᠬ      㭪,   㬥 format-string  㭪樨
         printf.  㭪 printf  ᠭ format-string   -
         㬥⮢.

               頥 祭.

               㭪  sprintf 頥 ⢮ ᨬ, ᠭ
          buffer.
               . ⠪ fprintf, printf, sscanf.

               ਬ.

               #include <stdio.h>

               char buffer[200];
               int i, j;
               double fp;
               char *s = "computer";
               char c;
               .

               .
               .

               /*  ଠ  ⠥ ࠧ  */

               j = sprintf(buffer, "%s\n", s);
               j + = sprintf(buffer+j, "%c\n", c);
               j + = sprintf(buffer+j, "%d\n",i);
               j + = sprintf(buffer+j, "%f\n",fp);.


               SQRT

               #include <math.h>

               double sqrt(x);
               double x;         ⥫쭮 祭  饩
                                 窮

               ᠭ.

               㭪 sqrt   ७ x.

               頥 祭.

               㭪 sqrt 頥  १  ᫥  ⭮
         .  ᫨  x  -  ⥫쭮,  㭪 ⠥ ᮮ饭 
         訡 DOMAIN  stderr, ⠭ errno  EDOM    頥
         0.
               aa  訡     ஢aa  
         楤 matherr.
               . ⠪ exp, log, matherr, pow.

               ਬ.

               #include <math.h>
               #include <stdlib.h>
               double x,y,z;
                .
               .
               .
               if ((z = sqrt(x+y))==o.0)
               if((x+y) < 0.0)
                  perror("sqrt of a negative number");


               SRAND

               #include<stdlib.h>              ॡ ⮫쪮   
                                                㭪樨

               void srand(seed);
               unsigned seed;                  砫쭮   ᫮  
                                               樨    砩
                                               ᥫ.


               ᠭ.

               㭪 srand ⠭ 砫     樨
         ⢠  ᥢ砩  楫.   ⢥ 㬥 seed 
         ⠭  ᯮ 1.    㣮  祭
         seed ⠭   砫 砩 .
               㭪  rand  ᯮ  ᪠ ᣥ஢ -
         砩 ᥫ.

               頥 祭.

               頥 祭 .
               . ⠪ rand.


               ਬ.

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

               int x, ranvals [20];

               /* ⠭  砩 ᥫ  砫쭮 -
         ﭨ  ࠭  ᨢ 20  ᣥ஢  砩
         ᥫ. */

               srand(17);
               for (x = 0; x < 20; ranvals[x++] = rand())
                         ;.


               SSCANF

               #include <stdio.h>

               int sscanf(buffer, format-string[, argument...]);
               char *buffer;               ࠭ 
               char *format-string;        ப ࠢ ଠ⮬

               ᠭ.

               㭪  sscanf ⠥   buffer  ᯮ, -
          arguments.  argument   㪠⥫  -
         ६ ⠪ ⨯,  ᮮ⢥ ⨯, । 
         format-string.
               Format-string        ᠬ
           㭪,  㬥 format-string    㭪樨  scanf.
          㭪 scanf  ᠭ format-string.

               頥 祭.

               㭪  sscanf 頥 ⢮ ᯥ譮 ८ࠧ-
           祭 .  頥  祭    ᮤঠ
         ⠭   祭 . 祭 EOF 頥 

         ⪥ 뢠  ப.頥 祭 0 砥,
           祭 .
               . ⠪ fscanf, scanf, sprintf.

               ਬ.

               #include <stdio.h>
               char *tokenstring = "15 12 14...";
               int i;
               float fp;
               char s[81];
               char c;
               .
                .
               .
               /*  ࠧ  */

               sscanf(tokenstring, "%s", s);
               sscanf(tokenstring, " %c", &c);
               sscanf(tokenstring, "%d", &i);
               sscanf(tokenstring, "%f", fp);.

               STACKAVAIL

               #include <malloc.h>    ॡ ⮫쪮  
                                      㭪樨
               unsigned int stackavail();


               ᠭ.

               㭪  stackavail 頥 ਡ⥫ ࠧ ⥪
          , 㯭  ᪮ ࠧ饭  ।-
         ⢮ 㭪樨 alloca.

               頥 祭.

               㭪 stackavail 頥 ࠧ    -
          楫.
               . ⠪ alloca, freect, memavl.

               ਬ.

               #include <malloc.h>

               main()
               {
               char * ptr;

               printf("Stack memory available before alloca=%u\n",
                     stackavail());
               ptr=alloca(100*sizeof(char));
               printf("Stack memory available after alloca=%u\n",
                     stackavail());
               }



               STAT

               #include <sys\types.h>
               #include <sys\stat.h>

               int stat(pathname, buffer);
               char *pathname;       path- 饣 䠩
               struct stat *buffer;  㪠⥫  ப, ਭ
                                     १

               ᠭ.

               㭪 stat 砥 ଠ   䠩    ४ਨ,
         ।  pathname,     ,  
         㪠뢠  buffer.   stat,     <sys\stat.h>,
         ᮤন ᫥騥 .

                                             祭

               st_mode              ⮢  ᪠   ଠ樨  ०
                                    䠩.     S_IFDIR  ⠭,
                                    ᫨  pathname  ।  ४਩;
                                       S_IFREG   ⠭,   ᫨
                                    pathname  뫠      䠩.
                                       ⥭/    ⠭
                                    짮⥫  ᮮ⢥⢨   ०
                                    㯠  䠩. 짮⥫ 믮
                                    ⠭ ⮢, ᯮ㥬   -
                                    ७  䠩.

               st_dev                  ன⢠  ᪠,  ᮤঠ饣
                                    䠩.

               st_rdev                 ன⢠  ᪠,  ᮤঠ饣
                                    䠩.
                                    (筮 st_dev).

               st_nlink             ᥣ 1.

               st_size               䠩   .

               st_atime             ६ ᫥ 䨪樨 䠩.

               st_mtime             ६ ᫥ 䨪樨 䠩
                                    (筮 st_atime).

               st_ctime             ६ ᫥ 䨪樨 䠩
                                    (筮 st_atime  st_mtime).


                 ⨯ stat    ⥫  ,
           MS DOS   ᫠.


               頥 祭.

               㭪  stat 頥 祭 0, ᫨ 祭 ଠ-
            䠩. 頥 祭 -1 ᢨ⥫  
         訡,    errno  ⠭    ENOENT, ..  䠩 
         path-  .

               . ⠪ access, fstat.

               砭. ᫨  pathname 뫠   ன⢮,
           ࠧ    ६    stat   ᫥
         祭.

               ਬ.

               #include <sys\types.h>
               #include <sys\stat.h>
               #include <stdio.h>

               struct stat buf;
               int result;
               char *args[4];
               .
               .
               .
               result = stat("child.exe", &buf);

               if (result == 0)
               if (buf.st_mode & S_IEXEC)
                  execv("child.exe", args);

               _STATUS87

               #include <float.h>

               unsigned int _status87();       砥 ᫮ 
                                               饩 窨

               ᠭ.

               㭪 _status87 砥 ᫮   饩  窨.
             饩  窨   樥 8087/80287
         ᫮      㣨  ﭨ,  㦨  8087/80287
         handler-, ⠪  ९   稬 ⥪ -
         饩 窨.

                頥 祭.

                   頥  祭   饩
         窨.  include-䠩 <float.h>    ᠭ  -
         ⮢, 頥 㭪権 _status87.

               砭! 設⢮  ⥬᪨  㭪-
         権   ᫮  8087/80287  ।᪠㥬묨 -
         ⠬. 頥 祭 㭪権  _clear87    _status87

         ⠭   ⮢묨 ᫥ 믮 ᪮쪨 -
         権  饩 窮   묨  ᮮ饭ﬨ  ᫮  
         饩 窨.
               . ⠪ _clear87, _control87.

               ਬ.

               #include <stdio.h>
               #include <float.h>

               double a = 1e-40, b;
               float x,y;

               main()
               {
               printf("status=%.4x-clear\n",_status87());

               /*    y     ﭭ -
          */
               y = a;
               printf("status=%.4x-inexect,underflow\n",
                      _status87());

               /* y ୮ */
               b = y;
               printf("status=%.4x-inexect,underflow,denormal\n",
                      _status87());

               /* ⪠ 짮⥫ 8087  */
               _clear87();
               }


               STRCAT-STRDUP

               #include<string.h>            ॡ ⮫쪮  
                                             㭪樨

               char *strcat(string1,string2);
                                              string2  string1
               char *string1;                ப-ਥ
               char *string2;                ப-筨

               char *strchr(string,c);       室 ࢮ 宦
                                             c  string
               char *string;                 ப-筨
               int c;                        ᪮ ᨬ

               int strsmp(string1,string2);  ࠢ ப
               char *string1;
               char *string2;

               int strcmpi(string1,string2); ࠢ   ப  
                                             ᨬ       ⨯
                                             ॣ

               char *string1;
               char *string2;

               char strcpy(string1,string2);     string2    
                                             string1
               char *string1;                ப-ਥ
               char *string2;                ப-筨

               int strcspn(string1,string2); 室  ப
                                             ᨬ    string1, 
                                             室  string2
               char *string1;                ப-筨
               char *string2;                ⢮ ᨬ

               char *strdup(string);         㡫 ப
               char *string;                 ப-筨

               int stricmp(string1,string2); ࠢ   ப  
                                             ᨬ       ⨯
                                             ॣ
               char *string1;
               char *string2;

               ᠭ.

               㭪樨 strcat, strchr, strcmp,  strcmpi,  strcpy,  strspn,
         strdup,  stricmp  ࠡ  ப, 稢騬 '\0' ᨬ-
         . 㬥 ப   㭪権 । 稥  㫥-
          ᨬ ('\0'), ⬥饣  ப.
                ஢   ப ஢ઠ  ९-
           믮.
               㭪 strcat  string2  string1, 稢 -
           ப  㫥  ᨬ  頥 㪠⥫ 
         ப-ਥ (string1).
               㭪 strchr  㪠⥫  ࢮ 宦 c  
         string.  c   㫥 ᨬ ('\0'); 㫥 ᨬ
         砭 string 砥  . 㭪 頥 NULL, -
          ᨬ  .
               㭪  strcmp ᨪ᪨ ࠢ ப string1
          string2  頥 祭, 饥  ᮮ⭮襭 ⠪,
           .

               祭                  

                0           string 1  string 2

               0                  string 1 ࠢ string 2

                0           string 1  string 2

               㭪樨 strcmpi  stricmp   稭-⢨⥫-
         묨 ﬨ strcmp.  㬥 string1  string2 ࠢ-
             ᨬ   ⨯ ॣ;  砥,  
         㪢 孥   ॣ஢ ᬠਢ 묨.
               㭪 strcpy   string2  (  㫥  ᨬ

         砭)    ᯮ,  ஥  ।  string1, 
         頥 string1.
               㭪  strcspn  頥    ࢮ   ᨬ   
         string1,  ਭ  ᨬ srting2.  -
         祭  ⭮  砫쭮 ப ப string1, -
          ᮤন  ᨬ,  室騥  ப string2.  -
         ᪥ 㫥 ᨬ 砭  ᬠਢ.  ᫨  string1
         稭    ᨬ,  ᮤঠ饣   ப string2, strcspn
         頥 0.
               㭪 strdup 墠뢠  ( ⮬ malloc)  
         ஢  string    頥 㪠⥫  , ᮤ
         ᪮஢ ப. 㭪 頥 NULL, ᫨   -
           墠祭.

               頥 祭   㭪権 ᠭ .
               . ⠪ strncat,  strncmp,  strncpy,  ctrnic,p,  strrchr,
         strspn.

               ਬ.

               #include <string.h>

               char string[100], template[100], *result;
               int numresult;
               .
               .
               .
               /*  ᮧ ப "computer program" ।⢮ ᯮ짮-
          strcpy  strcat */
               strcpy(string, "computer");
               result = strcat(string," program");
               /* 室 ப,  ன  ࠧ 㦥 'a' */
               result = strchr(string,'a');
               /* ।,   ப ,   ࠢ
         㣮 */
               numresult = strcmp(string, template);
               /* ࠢ  ப  ᨬ   ⨯  ॣ
         */
               numresult = strcmpi("hello", "HELLO");
               /* ᮧ  ப */
               result = strcpy(template,string);
               /* 室 "a","b","c"  ப */
               strcpy(string,"xyzabbc");
               result = strcspn(string,"abc");
               /* ᮧ  㪠⥫  ப  㡫஢ -
          */
               result = strdup(string);

               STRERROR

               #include <string.h>    ॡ ⮫쪮  
                                      㭪樨

               char *strerror(string);
               char *string;           ᮮ饭,        ⠢塞

                                       짮⥫

               int errno;              稪 訡
               int sys_nerr;           稪 ᮮ饭 ⥬
               char sys_errlist[sys_nerr];
                                       ᨢ ᮮ饭  訡

               ᠭ.

               ᫨  string ࠢ NULL, 㭪 strerror 頥 㪠-
         ⥫  ப, ᮤঠ ⥬ ᮮ饭  訡  -
          筮 맮,  ஬  ࠡ⠭  訡;  
         ப 稢 ᨬ  ப ('\n').
               ᫨ string  ࠢ NULL, strerror 頥 㪠⥫ 
         ப,  ᮤঠ ᮮ饭  訡, ⠢塞 짮-
         ; 稥; ஡; ⥬ ᮮ饭  訡  ᫥-
          筮 맮, ࠡ⠢襣 訡;   ᨬ  
         ப ('\n'). 饭 짮⥫   ᨬ -
           94 .
                 ⫨稨   perror, strerror  ⠥  ᮮ-
         .   ᮮ饭,  頥  strerror    stderr,  
         ணࠬ    printf, ਬ:
               if((access("datafile",2))++-1)
                printf(strerror(NULL));

                訡 ࠭  ६ errno,  
           譥 ஢. ⥬ ᮮ饭  訡 㯭 १
         ६ sys_errlist,   ᨢ  ᮮ饭  
         訡    稪  訡.  㭪樨 strerror ।⢮ -
         짮 祭 errno    sys_errlist   -
           ਡ⥫ ᮮ饭  訡. 祭 ६
         sys_nerr ।  ᨬ쭮 ᫮ ⮢   ᨢ
         sys_errlist.
               ⮡  ࠡ  ࠢ  १,  㭪 strerror
           맢 ࠧ ᫥ 筮 楤, -
         饩 訡.  祭 errno      १ᠭ  
         ᫥ 맮.

               頥 祭.

               㭪 strerror  頥  祭.
               . ⠪ clearerr, ferror, perror.


               砭.  MS DOS  祭 errno, ਢ 
         <errno.h>,   ᯮ. . ਫ  "饭  訡-
         ",  ਢ ᯨ᮪ 祭 errno  ᮮ⢥騥  ᮮ-
         饭   訡,  ਬ  MS DOS .   -
         祭 errno,  ᯮ㥬  MS DOS, 㭪 strerror ⠥
          ப.

               ਬ.

               #include <fcntl.h>
               #include <sys\types.h>

               #include <sys\stat.h>
               #include <io.h>
               #include <stdlib.h>

               int fh1, fh2;

               fh1 = open("data1", O_RDONLY);
               if (fh1==-1)
                   strerror("open failed on input file");

               fh2 = open("data2", O_WRONLY : O_CREAT,
                              S_IREAD : S_IWRITE);
               if (fh2==-1)
                   srterror("open failed on output file");

               STRLEN

               #include <string.h>    ॡ ⮫쪮  
                                      㭪樨

               int strlen(string);
               char *string;          ப, 稢 㫥
                                      ᨬ

               ᠭ.

               㭪 strlen 頥       ப  string,
         祬 㫥 ᨬ 砭 ('\0')    뢠.

               頥 祭.

               㭪  頥   string. 頥 祭 
         砥  .

               ਬ.

               #include <string.h>

               char *string="some space";
               int result;
               .
               .
               .
               /* ।  ப */
               result=strlen(string);  /* result = 10 */


               STRLWR

               #include <string.h>    ॡ ⮫쪮  
                                      㭪樨

               char strlwr(string);
               char *string;          ८ࠧ㥬 ப


               ᠭ.

               㭪 strlwr ८ࠧ뢠  㪢 孥 ॣ-
            ப string, 稢饩 㫥 ᨬ, 
         㪢  ॣ. 㣨 ᨬ  ᬠਢ.

               頥 祭.

               㭪 strlwr 頥 㪠⥫  ८ࠧ㥬 ப
         string. 頥 祭  砥 訡 .
               . ⠪ strupr.

               ਬ.

               #include <string.h>

               char string[100], *copy;
               .
               .
               .
               /* ᮧ  ப  ᨬ  ॣ */

               copy=strlwr(strdup(string));



               STRNCAT-STRNSET

               #include<string.h>     ॡ ⮫쪮  
                                      㭪樨

               char *strncat(string1,string2,n);
                                       n ᨬ  string2 
                                      string1
               char *string1;         ப-ਥ
               char *string2;         ப-筨
               unsigned int n;        ⢮ 塞 ᨬ

               char *strncmp(string1,string2,n);
                                      ࠢ    n  ᨬ
                                      ப
               char *string1;
               char string2;
               unsigned int n;        ⢮  ࠢ ᨬ-
                                      

               int strnicmp(string1,string2,n);
                                      ࠢ    n  ᨬ
                                      ப

               char *string1;
               char string2;
               unsigned int n;        ⢮ ࠢ  ᨬ-
                                      



               char *strncpy(string1,string2,n);
                                       n ᨬ  string2  
                                      string1
               char *string1;         ப-ਥ
               char *string2;         ப-筨
               unsigned int n;        ⢮ 塞 ᨬ

               char *strnset(string,c,n,);
                                      樠  n  ᨬ-
                                       ப string
               char *string;          樠㥬 ப
               int c;                 ᨬ-ਥ
               unsigned int n;        ⢮ ਭ ᨬ


               ᠭ.

               㭪樨 strncat, strnsmp, stricmp, strncpy, strnset ࠡ-
           묨 n ᨬ ப, 稢騬 㫥 ᨬ.
               㭪  strncat  n  ᨬ ப string2
          ப string1, 稢 १ ப 㫥  ᨬ-
          ('\0')  頥 㪠⥫  ப-ਥ (string1).
         ᫨ n , 祬  ப string2, ⮣  n ᯮ-
           ப.
               㭪 strncmp ᨪ᪨ ࠢ  n  ᨬ-
          ப string1  string2  頥 祭, ஥ 㪠-
         뢠  ⭮襭  ப,  ਢ :

               祭                  

                0           substring 1  substring 2

               0                  substring 1 ࠢ substring 2

                0           substring 1  substring 2

               㭪  stricmp  稭-⢨⥫쭮 ᨥ
         strncmp; 㭪 stricmp ࠢ  ப string1   string2
           ᨬ  ⢨⥫쭮  ॣࠬ;  砥,
           㪢 孥   ॣ஢  ᬠਢ  
         .
               㭪  strncpy  筮 n ᨬ ப string2 
         ப string1  頥 string1. ᫨  n  ,  祬  
         string2, 㫥 ᨬ 砭 ('\0') ⮬᪨  -
           㥬 ப. ᫨ n , 祬   string2,  -
           string1  㫥묨 ᨬ,   -
           n.
               㭪 strnset ⠭  n  ᨬ  string  
         ᨬ  c    頥  㪠⥫    ப. ᫨ n
         , 祬  ப  string,    n  ᯮ  
         string.
               . ⠪  strcat, strcmp, strcpy, strset.


               ਬ.

               #include <string.h>

               char string[30]={"12345678901234567890"};

               main()
               {
               char copy[100], suffix[100], *result;
               int numresult;
               unsigned int nresult;
               .
               .
               .
               /*    ப   ப suffix,   祬 10
         ᨬ (30   砫쭮 ப). (᫨   ਬ  -
            10 ᨬ,   㤥 ᠭ  -
          祭) */

               result = strncat(string,suffix,10);

               /* । 冷 ᫮  ப,   ᮤন  
         "program",   ᬠਢ   7 ᨬ. ᫨ ப -
         ন 䨪 "program", strncmp 頥 0 */

               strcpy(string,"programmer");
               numresult = strncmp(string,"program",7);

               /* ࠢ 4 ᨬ  ப  ᨬ   ⨯
         ॣ */

               strcpy(string,"PROGRESS");
               nresult = stricmp(string,"program",4);

               /*  99 ᨬ ப */

               result = strncpy(copy,string,99);

               /* ⠭  4 ᨬ ப  ᨬ 'x' */

               result = strnset("computer",'x',4);
               }


               STRPBRK

               #include<string.h>     ॡ ⮫쪮  
                                      㭪樨

               char *strpbrk(string1,string2);
                                      室  ᨬ  string2
                                       string1
               char *string1;         ப-筨
               char *string2;         ⢮ ᨬ


               ᠭ.

               㭪  strpbrk  室 ࢮ 宦  string1 
         ᨬ  string2. 㫥 ᨬ 砭  ᪥   -
         ਢ.

               頥 祭.

               㭪  strpbrk  頥  㪠⥫  ࢮ 宦
         ᨬ  string2  string1.
               NULL-㪠⥫  ।  ⢨    ᨬ   
         string1   string2.
               . ⠪ strchr, strrchr.

               ਬ.

               #include <string.h>

               char string[10], *result;
               .
               .
               .
               /*  頥  㪠⥫  ࢮ 宦  ப 
         'a,'  'b' */

               result = strpbrk(string,"ab");

               STRRCHR

               #include<string.h>     ॡ ⮫쪮  
                                      㭪樨

               char *strrchr(string,c);
                                      室 ᫥ 宦 c 
                                      string
               char *string;          ப-筨
               int c;                 ᨬ ᪠

               ᠭ.

               㭪 strrchr 室 ᫥  宦  ᨬ  c  
         ப  string. 㫥 ᨬ 砭 ('\0') ப string -
         砥  . (ᯮ strchr  ᪠ ࢮ 宦
         c  ப string).

               頥 祭.

               㭪 strrchr 頥 㪠⥫  ᫥ 宦
         c  string. ⥫ NULL 頥, ᫨  ᨬ  
         .
               . ⠪ strchr, strpbrk.

               ਬ.

               #include <string.h>


               char string[100], *result;
               .
               .
               .
               /* 室 ᫥ 宦 ᨬ 'a'  ப */
               result = strrchr(string,'a');.

               STRREV

               #include<string.h>     ॡ ⮫쪮  
                                      㭪樨

               char *strrev(string);
               char *string;          ࠭塞 ப

               ᠭ.

               㭪 strrev ࠭ 冷 ᨬ   ப
         string. 㫥 ᨬ 砭 ('\0') ⠥  .

               頥 祭.

               㭪  strrev  頥 㪠⥫   string.
         頥 祭  砥 訡 .
               . ⠪ strcpy, strset.

               ਬ.

               #include <string.h>

               char string[100];
               int result;
               .
               .
               .
               /* ।,   ப ஬, .. ⠥-
            אַ  ⭮ 浪 */
               result = strcmp(string,strrev(strdup(string)));
               /* ᫨ result == 0, ப  ஬ */


               STRSET

               #include<string.h>     ॡ ⮫쪮  
                                      㭪樨

               char *strset(string,c);
               char *string;          ⠭ ப
               int c;                 ᨬ-ਥ


               ᠭ.

               㭪 strset ⠭  c   ᨬ    
         ப string, ᪫ 㫥 ᨬ 砭 ('\0').


               頥 祭.

               㭪  strset  頥 㪠⥫   ப.
         頥 祭 .
               . ⠪ strnset.

               ਬ.

               #include <string.h>

               char string[100], *result;
               .
               .
               .
               /* ⠭ ப,   ஡ */
               result = strset(string, ' ');


               STRSPN

               #include<string.h>     ॡ ⮫쪮  
                                      㭪樨

               int strspn(string1,string2);
               char *string1;         ᪮ ப
               char *string2;         ⢮ ᨬ

               ᠭ.

               㭪 strspn 頥  ࢮ ᨬ    ப
         string1,     ਭ  ᨬ string2. 
         祭 ⭮  砫쭮 ப  ப string1,
           ⮨   ᨬ  ப  string2.  㫥
         ᨬ  砭 ப string2  ᬠਢ. ᫨ string1
         稭  ᨬ,  室饣  string2,  strcpn  頥
         0.

               頥 祭.

               㭪  strspn 頥 楫 祭, ।饥 -
          ࢮ ᨬ  string1,   ᮤঠ饣  string2.
               . ⠪ strcspn.

               ਬ.

               #include <string.h>

               char *string="cabbadge";
               int result;
               .
               .
               .
               /* ।  䨪, ᮤঠ饣 a,b  c */
               result = strspn(string,"abc"); /* result = 5 */


               STRSTR


               #include<string.h>     ॡ ⮫쪮  
                                      㭪樨

               char *strstr(srting1,string2);
               char *string1;         ᪮ ப
               char *string2;         ப-蠡

               ᠭ.

               㭪 strstr 頥  㪠⥫    ࢮ  宦
         string1  string2.

               頥 祭.

               㭪   strstr  頥  㪠⥫    string1,  ᫨
         string1 㦥,  NULL - ᫨ string1 .
               . ⠪ strcspn.

               ਬ.

               #include <string.h>

               main()
                 {
                 char *string1="needle in a haystack";
                 char *string2="hay";

                 printf("%s\n", strstr(string1,string2));
                 }

                室:
               haystack

               STRTOD-STRTOL

                #include <stdlib.h>

                double strtod(nptr, endptr);  ८ࠧ  ப,
                                                㪠뢠
                                              nptr,  double

                char *nptr;                   㪠⥫   ப
                char **endptr;                㪠⥫    
                                              ᬮ

                long strol(nptr,endptr,base); ८ࠧ ப 
                                              long  筮 -
                                              ,   ⭮
                                                 ᭮-
                                               base
                char *nptr;

                char **endptr;
                int  base;                    ᯮ㥬 ᭮-
                                              


               ᠭ.

               㭪樨 strtod  strtol ᮮ⢥⢥ ८ࠧ ᨬ-
          ப  祭   筮      楫
         祭.  室  ப  string ।⠢ ᮡ ᫥-
         ⥫쭮 ᨬ,    ᫮  -
           ᯥ樠쭮  ⨯.  㭪樨 ४ ⥭ ப 
         ⮫쪮  ᨬ,      ᫠ (
           㫥 ᨬ '\0   ப);  strtol ᨬ
         뢠   ⠪  ஢ ᨬ,  -
           ࠢ base. ᫨ endptr -  NULL,  *endptr  㪠뢠  
          ᨬ,  ஬ ⠭ ᬮ.
               㭪  strtod ।,  nptr 㪠뢠  ப,
          ᫥ :

         [whitespace][sign][digiits][.digits][{d:D:e:E}[sign]digits]

                 ࢮ ᨬ,  ⢥饣  ⮩  ଥ,
         ࠡ⪠ ४頥.
               㭪  strtol  ।,  nptr 㪠뢠  ப
         ᫥饩 :

               [whitespace][sign][0][x][digits]

               ᫨ base   2  36,  祭 ᯮ 
         ᭮ ⥬ ᫥  ᫠.
               ᫨ base = 0, 砫 ᨬ ப,    㪠-
           nptr,  ᯮ   । ᭮. ᫨ 
         ᨬ - 0  ன -     1  7,  ப -
           쬥筮 楫; ᫨  ᨬ 0,  ன x
          X, ⮣ ப   ⭠筮 楫;  ᫨
          ᨬ ਭ ᫥⥫쭮 1-9,  ப -
           筮 楫.

               頥 祭.

               㭪  strtod  頥 祭 ᫠  饩 -
         , ᪫ 砨 ९   १ (.. -
         ᮫⭮ 祭 १ , 祬  ⨬ 
         ।⠢ ᫠).  砥 ९   稬
         १ 頥 ᮮ⢥⢥ +HUGE  -HUGE.
               㭪 strtol 頥 祭 ८ࠧ  ப,
         ᪫ 砩 ९   १.  ⮬ 砥
         頥  ᮮ⢥⢥  LONG_MAX   LONG_MIN.  㭪樨
         ⠭ errno  ERANGE.
               . ⠪ atof, atol.

               ਬ.

                #include <stdlib.h>


                main()
                 {
                 char *string, *stopstring;
                 double x;
                 long l;
                 int bs;

                 string="3.1415926This stopped it";
                 x=strtod (string, &stopstring);
                 printf ("string=%s\n",string);
                 printf (    strtod=%ld (base %d)\n", l, bs);
                 printf ("   Stopped scan at %s\n\n", stopstring);
                 string="10110134932";
                 printf ("string=%s\n", string);
                 for (bs=2; bs<=8; bs*=2)  {
                 l=strtol(string, &stopstring, bs);
                 printf (" strtol=%ld (base %d)\n",l,bs);
                 printf (" Stopped scan at %s\n\n",stopstring);
                  }
                }

                室:

               string = 3.1415926This stopped it
                 strtod = 3.141593
                 Stopped scan at This stopped it

               string = 10110134932
                 strtol = 45 (base 2)


                 Stopped scan at 34932

                 strtol = 4423 (base 4)
                 Stopped scan at 4932

                 strtol = 2134108 (base 8)
                 Stopped scan at 932

               STRTOK

               #include<string.h>    ॡ  ⮫쪮  
                                     㭪樨

               char *strtor(string1,string2);
                                     室 ᨬ  string1
               char *string1;        ப, ᮤঠ ᨬ
               char *string2;        ⢮ ᨬ-࠭⥫

               ᠭ.

               㭪 strtok ⠥ ப string1  ⢮  
          , 㦠  ⢥ ࠭⥫    ᨬ  
         string1.   string1  ⤥    -

         ⥫   string2.   string1 ࠧ뢠 ⮫쪮 ࠧ,
         ᪮쪮 뢠 strtok.  ࢮ 맮 strtok   
         ப string1, strtok 室  ᨬ  string1, ய᪠
         ।騥  ࠭⥫.  ⥫ 頥   .
          ⮣, ⮡  ᫥騩 ᨬ    string1,  㭪
         strtok  뢠   NULL 祭  㬥 string1.
         㬥 NULL ப string1 뢠 strtok  ᪠ ᫥-
            ।饩 ப  ᨬ.  ⢮  ࠭⥫
             ࠧ   맮  맮, ⠪  string2 
         ਭ  祭.
               砭. String1   ஢  맮  strtok,
         ⠪   ᫥ 맮 strtok  string1 ⠢ 㫥 -
          ('\0').

               頥 祭.

                맮 strtok  ࠧ,  頥  㪠⥫  
           ᨬ  string1.  ᫥ 맮  ⮩  ᠬ
         ப ᨬ, strtok 頥 㪠⥫  ᫥騩  ᨬ
          ப. ⥫ NULL 頥,    ᨬ.
          ᨬ 稢 㫥.
               . ⠪ strcspn, strspn.

               ਬ.

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

               char *string = "a string, of , ,tokens";
               .
               .
               .
               /*   ᫥饬 横 ᮡ ᨬ (⤥ ஡-
           묨)  ப   ,    祣  -
         ⠭ */
               token = strtok(string,",");

               while  (token  !=NULL)   {
               /* ⠢   ࠡ⪨ ᨬ  横 */
                      .
                      .
                      .
               token = strtok(NULL,",");
               /*  ᫥騩 ᨬ */
                    }

               /* 頥묨  ᨬ    "a","string",  "of",
         "tokens". 騩 맮 strtok  NULL  横 蠥-
          */


               STRUPR

               #include<string.h>     ॡ ⮫쪮  
                                      㭪樨


               char *strupr(string);
               char *string;          ப,       ८ࠧ㥬   
                                      孥  ॣ

               ᠭ.

               㭪  strupr ८ࠧ  㪢  ॣ 
          string  㪢 孥  ॣ.  㣨  ᨬ  
         ᬠਢ.

               頥 祭.

               㭪 strupr 頥 㪠⥫  ८ࠧ㥬 ப
         string. 頥 祭  砥 訡 .
               . ⠪ strlwr.

               ਬ.

               #include<string.h>

               char string[100], *copy;
               .
               .
               .
               /* ᫥騩    ப  孥 ॣ-
          */
               copy = strupr(strdup(string));


               SWAB

            #include <stdlib.h>             ॡ  ⮫쪮  
                                             㭪樨

            void swab(source, destination, n);
            char *source;                   㥬  ⠢-
                                            塞  ()
                                            
            char *destination;              ࠭  ⠢-
                                             
            int n;                          ᫮       㥬
                                            ⮢

               ᠭ.

               㭪 swab  n ⮢  source, ⠢ (-
         )      ᬥ  ⮢    ࠭  १  
         destination.  n   묨 ᫠,  騬
         ⠭ ().
               㭪  swab  筮  ᯮ  ⮢ 
           뫪   ᫨⥫쭮 設,   ᯮ-
          ࠧ 冷 ⮢.

               頥 祭.

               頥 祭 .
               . ⠪ fgets, fputs.



               ਬ:

            #include <stdlib.h>
            #define NBYTES  1024

            char from[NBYTES],  to [NBYTES];

               /*    n ⮢   ᯮ  㣮, -
         ⠢ ()   ᬥ ⮢ */

            swab(from, to, NBYTES);.


               SYSTEM

            #include <process.h>   ॡ ⮫쪮  
                                   㭪樨
            #include <stdlib.h>    ᯮ    <process.h>,
                                    <stdlib.h>

            int system(string);
            char *string;          믮塞 


               ᠭ.

               㭪  system ।  ப string  -
            ࠡ뢠  ப   MS DOS. 㭪-
          system 뫠  ६ 㦥 COMSPEC  PATH, -
          ᯮ 䠩 COMMAND.COM,  ᯮ   믮-
           string.


               頥 祭.

               ᫨  string  ᯥ譮 ࠡ⠫, 㭪 system 頥
         祭 0. 頥 祭 -1 ᢨ⥫  訡  
         errno ⠭    ᫥ 祭:

                                     

          E2BIG            ᮪ 㬥⮢   ॢ蠥
                           128 ⮢,  ࠭⢮, ॡ㥬
                            ଠ樨 㦥, ॢ蠥 32.

          ENOENT           COMMAND.COM    .

          ENOEXEC             COMMAND.COM          
                           믮    ଠ.

          ENOMEM            믮 child-   
                           筮,        
                           祭,      
                           , 㪠뢠騥,   parent-
                            墠祭.



               . ⠪ execl, execle,  execlp,  execv,  execve,  execvp,
         exit, _exit, spawnl, spawnle, spawnlp, spawnlpe, spawnv, spawnve,
         spawnvp.

               ਬ:

            #include <process.h>

            int result;


               /* ᫥騩    ᨨ DOS  log 䠩-
          */

            result = system("ver >> result.log");



            TAN-TANH

            #include <math.h>

            double tan(x);        ⠭ x
            double tanh(x);       ࡮᪨ ⠭ x
            double x;            ࠤ

               ᠭ.

               㭪樨  tan   tanh  ᮮ⢥⢥ ⠭  -
         ࡮᪨ ⠭ x.

               頥 祭.

               㭪 tan 頥 ⠭ x. ᫨ x 让,    -
         ᫥      筠  稬.  ⮬
         砥 tan ࠡ뢠 訡 PLOSS,  ᮮ饭    ⠥.
         ᫨ x ⮫쪮 让,   稬 १ -
         , ⮣ tan ⠥ ᮮ饭  訡 TLOSS  stderr  -
         頥 0.    errno ⠭  ERANGE.
               㭪  tanh 頥 ࡮᪨ ⠭ x. -
         頥 祭  砥 訡 .
               .⠪ acos, asin, atan, atan2, cos, cosh, sin, sinh.

               ਬ:

            #include <math.h>

            double pi,x,y;

            pi = 3.1415926535;
            x = tan(pi/4.0);     /* x ࠢ 1.0 */
            y = tanh(x);         /* y ࠢ 1.6 */




               TEMPNAM - TMPNAM

            #include <stdio.h>

            char *tmpnam(string);
            char *string;            㪠⥫  ६ .

            char *tempnam(dir, prefix);
            char *dir;
            char *prefix;

               ᠭ.

               㭪 tmpnan    ६  䠩.    
         ࠭    string.  ᫨ string  NULL,   ப
         ࠧ頥 ।⢮ 㭪樨 malloc.  ⮬, ᫨  ᯮ짮-
          㭪 malloc, 짮⥫ ᠬ  ⢥⢥ 
         ᢮ .
               쭠  ப, ᮧ  tmpnam, ⮨   
         "0"  "9"; ᫥ 祭 ⮩ ப     1
          65535.
               㭪  tempnam    짮⥫ ᮧ ६
         䠩  㣮 ४ਨ. Prefix  ⠢   䠩-
         .  㭪 ᬠਢ 䠩     㣨 -
         ४, ᯮ  浪 設⢠.


                                    

         ⠭    ६   ४਩,  ।塞
         㦥  TMP,       .
         ४਩,  ।塞
          TMP.

         ६  㦥  TMP    㬥 dir   tempnam.
         ⠭         
                 ४਩,
         ।塞  TMP.

         㬥  dir    NULL   P_tmpdir   <stdio.h>.
           dir     
         饣 ४⮨.

           P_tmpdir.         \tmp.

               ᫨   , tempnam 頥 祭 NULL.

               頥 祭.

                㭪樨  㪠⥫    ᣥ஢  ,
         ᫨     ᮧ  ,  ᫨   
         ⢥ (㭨). ᫨     ᮧ  
         ᥣ , 㭪樨 tmpnam  tempnam  
         祭 NULL



               . ⠪ tmpfile.

               ਬ:

            #include <stdio.h>

            main ()
            {
            char *name1, *name2;

            if ((name1 = tmpnam(NULL)) != NULL)
               printf("%s is safe to use as a temporary file.\n",
                      name1);
            else
               printf("cannot create a unique file name\n");

            if ((name2 = tempnam("a:\\tmp", "stq")) != NULL)
               printf("%s is safe to use as a temporary file.\n",
                      name2);
            else
               printf("cannot create a unique file name\n");
            }.



               TELL

            #include <io.h>    ॡ  ⮫쪮    
                               㭪樨
            long tell(handle);
            int handle;        handle-,  뫠騩  
                               䠩

               ᠭ.

               㭪  tell  ⥪  㪠⥫  䠩 (᫨
          ), 易  handle.  ࠦ  ᫮  -
         ⮢  砫 䠩.

               頥 祭.

               㭪  tell 頥 ⥪ . 頥 -
         祭 -1L 㪠뢠  訡   errno ⠭    EBADF,
         ஥ ।  㬥 handle- 䠩.  ன-
         ,    ᯮᮡ   (⠪  ନ  ਭ-
         ), 頥 祭  ।.
               .⠪ ftell, lseek

               ਬ:

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

            int fh;
            long position;

            fh = open ("data", O_RDONLY);
            .
            .
            .
            position = tell (fh);
            /*  ⥪  */
            .
            .
            .
            lseek (fh, position,0);
            /* 室 ।  */




               TIME

            #include <time.h>  ॡ ⮫쪮  
                               㭪樨
            long time(timeptr);
            long *timeptr;       ࠭ ६

               ᠭ.

               㭪 time  ᮮ⢥⢨  ⥬묨 ᠬ  頥
         ⢮  ᥪ㭤,  襤    00:00:00  祭 ६ 
         ਭ,..  1 ﭢ 1980 . 頥 祭 ࠭-
           ᯮ,   timeptr. ᫨ 頥 -
           , timeptr  NULL.


               頥 祭.

               㭪 time 頥 ன ६ ( ᥪ㭤). -
         頥 祭 .
               .⠪ asctime, ftime, gmtime, localtime, utime.

               ਬ:

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

            long ltime;

            time(&ltime);
            printf("the time is %s\n", ctime(&ltime));




               TMPFILE


            #include <stdio.h>

            FILE *tmpfile();           祭,   㪠뢠饥  
                                          ⨯   FILE.

               ᠭ.

               㭪 tmpfile ᮧ ६ 䠩  頥  㪠-
         ⥫      䠩.  ᫨  䠩      , 㭪
         tmpfile 頥 㪠⥫ NULL.  ६ 䠩  ⮬-
         ᪨ 㤠,  ணࠬ 稢 ଠ쭮   -
          맢 㭪 rmtmp,  ⥪騩 ࠡ稩 ४਩   -
         .
               ६ 䠩 뢠  ० "w".

               頥 祭.

                㭪 頥 㪠⥫  ⮪. ᫨ 䠩  -
         뢠 - 頥 NULL-㪠⥫.
               . ⠪ tmpnam, tempnam, rmtmp.

               ਬ:

            #include <stdio.h>

            FILE *stream;
            char tmpstring[] = "String to be temporary written".

            main ()

            {
            if ((stream = tmpfile()) == NULL)
                perror("Couldn't make temporary file");
            else
                fprintf(stream, "%s", tmpstring);
            }.



               TOASCII-_TOUPPER

            #include <ctype.h>
            int toascii(c)        ८ࠧ "c"    ᨬ  ASCII

            int tolower(c)        ८ࠧ  "c"  ᨬ 孥
                                  ॣ   (    㪢),
                                  ᫨  

            int _tolower(c)       ८ࠧ "c"     㪢

            int toupper(c)        ८ࠧ "c"   ᨬ  
                                  ॣ (ய 㪢), ᫨
                                   

            int _toupper(c)       ८ࠧ "c"   ᨬ  

                                  ॣ

            int c;                ८ࠧ㥬 ᨬ


               ᠭ.

                toascii, tolower, toupper  _toupper ८ࠧ ᨬ-
          "c" ⠪,  ᠭ .
                toascii ⠭  7 ⮢ "c"    ⠪,
           ८ࠧ  祭  ᮮ⢥ ᨬ ASCII. ᫨
         "c" 㦥 ᮮ⢥ ASCII,    .
                tolower ८ࠧ "c"    㪢,  ᫨  "c"
         ᮮ⢥ ய᭮ .  - "c"  .
                 _tolower    ᨥ  tolower, ᯮ饩
         ⮫쪮 ⮣,  "c" - ய᭠ 㪢. ᫨    ⠪,  -
          믮 _tolower  ।.
                toupper ८ࠧ "c"   㪢, ᫨ "c" 
          筮 㪢.  - "c"  .
               _Toupper  ᨥ toupper, ᯮ㥬 ⮫쪮 ⮣-
         ,    "c"  -  筠 㪢. ᫨ "c"   筮
         㪢,  १  ।.

               頥 祭.

                toascii, tolower, toupper  _toupper   -
         ࠧ  ᨬ  "c". 頥 祭  砥 訡
         .
               .⠪   isalnum,  isalpha,  isascii,  iscntrl,  isdigit,
         isgraph, islower, isprint, ispunct, isspace, isupper, isxdigit.

               砭.   楤  ॠ    .  
         tolower    toupper  ⠪ ॠ   㭪樨, .. ᨨ
          ४⭮ ࠡ뢠 㬥   묨  䥪⠬.
         ᨨ 㭪権   ᯮ짮, ᫨ 㤠 ம।-
           ४⨢ #undef    <ctype.h>. ।
         㭪権 tolower  toupper   <stdlib.h>.

               ਬ:

               #include <stdio.h>
               #include <ctype.h>
               int ch;

               /*᫥騥   
         **ᨬ   00  07f.
         ** toupper  tolower ਬ
         **   .  _Toupper  _tolower
         **ਬ ⮫쪮  , 
         ** */

               for (ch=0; ch<=0x7f; ch++)  {
                   printf (" toupper=%#04x", toupper (ch));
                   printf (" tolower=%#04x", tolower (ch));


                   if (islower(ch))
                      printf(" _toupper=%#04x", _toupper(ch));
                   if (isupper(ch))
                      printf("_tolower=%#40x", _tolower(ch));
                   putchar ('\n');
                   }



               TZSET

            #include <time.h>  ॡ ⮫쪮  
                               㭪樨

            void tzset();

            int daylight;      䫠 室  ⭥/
                               ६
            long timezone;     ࠧ稥  ᥪ㭤  GMT
            char *tzname[2]l   ப 㪢 ६
                               

               ᠭ.

               㭪 tzset ᯮ ⥪ ⠭ ६ -
          TZ, ⮡   祭  ६  ६:  daylight,
         timezone,  tzname.    ६ ᯮ 㭪ﬨ ftime,
         localtime   祭 ६    ਭ  (GMT)  
         ⭮ ६.
               祭 ६ 㦥 TZ   㪢
           ६  ,  ⠪  PST, ᫥饩  易⥫
          ᫮, 騬 ࠧ稥    祭 ६-
           ਭ   ६.᫮    㪢-
           室  ⭥/ ६, ⠪  PDT.  -
         ,  "PST8PDT"  ।⠢  ⢨⥫쭮  祭   
         Pacific time.
                 뢠  tzset,  ६  daylight,  timezone,
         tzname  ᫥騥 祭:

            ६                      祭

            timezone       稥    祭  ६  
                           ਭ   ६

            daylight       㫥 祭, ᫨  ⠭ TZ
                           ।  室      ⭥/
                           ६;  -0

            tzname[0]      ப     祭,    ।饥
                           㪢    ६    
                           ⠭ TZ

            tzname[1]      ப  祭,  ।饥 
                           室   ⭥/  ६,  
                             ப, ᫨   ய饭
                            ⠭ TZ




               ᫨   TZ    ⠭,    㬮砭  ⠭
         PST8PDT,  ᮮ⢥  Pacific  time.    㬮砭
          daylight ⠭ 1, timezone - 28800,  tzname[0] -
         "PST", tzname[1] - "PDT".


               頥 祭.

               頥 祭 .
               .⠪ asctime, ftime, localtime.

               ਬ:

            #include <time.h>

            int daylight;
            llong timezone;
            char *tzname[];
            .
            .
            .
            putenv("TZ=EST5");
            tzset();


               ULTOA

            #include <stdlib.h>           ॡ   ⮫쪮   
                                           㭪樨
            char ultoa(value, string, radix);

            unsigned long value;          ८ࠧ㥬 ᫮
            char *string;                 ப १
            int radix;                    ᭮ value

               ᠭ.

               㭪 ultoa ८ࠧ ᨬ value  ᨬ  -
         , 稢 NULL-ᨬ,     string. -
             ஫. 㬥 radix । ᭮
         ⥬ ᫥ value.   ਭ 祭  2  36.

               頥 祭.

               㭪  ultoa 頥 㪠⥫  ப string. -
         頥 祭  砥 訡 .
               .⠪ itoa, ltoa.

               砭: , ⢮  string,    -
         ,  祬  ॡ    頥 ப. 㭪 頥
         ப   33 ⮢.


               ਬ:

                #include <stdlib.h>

                int radix = 16;
                char buffer [40];
                char *p;
                        /* p 㤥 "501d9138 */
                p=ultoa (1344115000L, buffer, radix);



               UMASK

            #include <sys\types.h>
            #include <sys\stat.h>
            #include <io.h>       ॡ ⮫쪮   
                                  㭪樨

            int umask(pmode);
            int pmode;            , ࠧ襭  㬮砭

               ᠭ.

               㭪 umask ⠭    ⥪饣    
         ࠧ襭  㯠   䠩  ०,  । 
         pmode. ᪠ ࠧ襭 㯠  ᯮ    䨪樨
         ⠭  㯠     䠩, ᮧ ।⢮
         㭪権 create, open  sopen. ᫨   ᪥ ࠢ 1,   -
         ⢥騩     祭 ० 㯠  䠩 ⠭-
           0 (饭). ᫨   ᪥ ࠢ 0, ᮮ⢥-
         騩   ⠥ . ᪠ 㯠   䠩-
           ⠭,  䠩  ஥    ࠧ. -
          pmode  ⠭ ࠦ, ᮤঠ騬    
             ⠭  S_IWRITE    S_IREAD, । 
         <sys\stat.h>.   ⠭,  ꥤ -
          ஬ (:).

               祭 㬥 pmode ਢ .

         祭                           

         S_IWRITE             ᪠ (䠩 ⮫쪮  
                            ⥭)

         S_IREAD            ⥭  ᪠ (䠩 ⮫쪮  
                            )


               ਬ, ᫨  ᪥ ⠭  ,    
         䠩  㯭  ⥭.

               砭.   MS DOS  䠩 㯭  ⥭, ⮬
          ⮫쪮    .    砥,  
         ⠭  ⥭  umask   ᫠.


               頥 祭.

               㭪 umask 頥 ।饥 祭 pmode. -
         頥 祭  砥 訡 .
               .⠪ chmod, creat, mkdir, open.


               ਬ:

            #include <sys\types.h>
            #include <sys\stat.h>
            #include <io.h>

            int oldmask;

            oldmask=umask(S_IWRITE);
            /* ᮧ 䠩 ⮫쪮  ⥭ */



               UNGETC

            #include <stdio.h>

            int ungetc(c, stream);
            int c;                     頥 ᨬ

            FILE *stream;              㪠⥫  
                                       ⨯ FILE

               ᠭ.

               㭪 ungetc 頥 ᨬ "c"   ⮪ 
         stream. Stream   ਧ     ⥭.
         ᫥    ⥭  stream 稭  ᨬ "c".
         EOF   ⮪ ।⢮ ᯮ짮 ungetc .  
         㭪 頥 祭 訡, ᫨  stream 祣  -
         ⠭     ᫨ "c"   饭. , ࠧ頥 
         ⮪ ।⢮ ungetc,    㭨⮦,  ᫨  㭪樨
         fseek  rewind 맢 । 뢠 ᨬ  stream.

               頥 祭.

                 㭪  頥 㬥 ᨬ "c". 頥
         祭 EOF ᢨ⥫   㤠筮  饭  
         ᨬ.
               . ⠪ getc, getchar, putc, putchar.

               ਬ:

            #inc <stdio.h>
            #include <ctype.h>

            FILE *stream;

            int ch;
            int result = 0;
            .
            .
            .
               /* ᫥騥  롨 筮 楫   ⮪
         stream */

            while ((ch = getc(stream)) != EOF && isdigit(ch))
                  result = result * 10 + ch - '0';

            if (ch != EOF)
               ungetc(ch, stream);
               /* 頥   筮 楫. */


            UNGETCH

            #include <conio.h>     ॡ ⮫쪮  
                                   㭪樨

            int ungetch(c);
            int c;                 頥 ᨬ

               ᠭ.

               㭪  ungetch 頥 ᨬ "c"  ᮫  ।-
            ᫥騩 ⠥ ᨬ. 㭪 ungetch  믮-
         , ᫨ । ᫥騬 ⥭   뢠     祬
          ࠧ.

               頥 祭.

               㭪  ungetch 頥 ᨬ "c", ᫨ 㭪 㤠筮
         ࠡ⠫. 頥 祭 EOF 㪠뢠  訡.
               .⠪ cscanf, getch, getche.

               ਬ:

            #include <conio.h>
            #include <ctype.h>

            char bufffer[100];
            int count=0;
            int ch;

               /*  ᫥騩   祭, ࠭祭 ஡
          묨 ப,   */

            ch = getche();

            while (isspace(ch))
                ch = getche();

            while (count < 99)

            {  if (isspase(ch))
               break;

               buffer[count++] = ch;
               ch = getche();
            }

            ungetch(ch);
            buffer[count] = '\0';


               UNLINK

            #include <io.h>     ॡ  ⮫쪮   
                                㭪樨
            #include <stdio.h>  ᯮ      <io.h>,  
                                <stdio.h>

            int unlink(pathname);
            char *pathname;     path- 㤠塞 䠩

               ᠭ.

               㭪 unlink 㤠 䠩, ।  pathname.

               頥 祭.

               㭪 unlink 頥 0, ᫨ 䠩 ᯥ譮 㤠. -
         頥 祭 -1 ᢨ⥫  訡   errno ⠭-
             ᫥ 祭:

           祭                          

          EACCES             Path- । ४਩  䠩
                             ⮫쪮  ⥭

          ENOENT               path-  

               .⠪ close, remove.

               ਬ:

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

            int result;

            result=unlink("tmpfile");
            if (result == -1)
              perror("couldn't delete tmpfile");


               UTIME

            #include <sys\types.h>

            #include <sys\utime.h>

            int utime(pathname, times);
            char *pathname;                  path- 䠩
            struct utimbuf *times;           㪠⥫  ࠭
                                             祭 ६

               ᠭ.

               㭪 utime ⠭ ६ 䨪樨 䠩,  -
           ।  pathname.      -
           䠩,    ६  㤥 .
               ᪮  utimbuf ᮤন  ६  㯠,
          MS DOS ⠭ ⮫쪮 ६ 䨪樨.
               ᫨  times  NULL-㪠⥫, ६ 䨪樨 -
         ⠭  ⥪饬 ६.   times   㪠뢠
             ⨯ utimbuf, ।  <sys\utime.h>.  ⮩
          ६ 䨪樨 ⠭   modtime.

               頥 祭.

               㭪 utime 頥 祭 0, ᫨ ६ 䨪樨
         뫮 . 頥 祭 -1 ᢨ⥫   訡-
            errno ⠭    ᫥ 祭:

                                  

            EACCES           Path-  䠩 । ४਩
                              䠩, ।祭 ⮫쪮  
                             ⥭.

            EMFILE                   䠩
                             (䠩           
                              ६  䨪樨).

            ENOENT             path-  .

               .  ⠪ asctime, ctime, fstat, ftime, gmtime, localtime,
         stat, time.


               ਬ.

            #include <sys\types.h>
            #include <sys\utime.h>
            #include <stdio.h>
            #include <stdlib.h>

               /* ६ 䨪樨 䠩 ⠭  ⥪饬 -
          */

            if (utime("/tmp/data", NULL) == -1)
                     perror ("utime failed").




               VA_ARG - VA_START

            #include <varargs.h>           ॡ          
                                           ᮢ⨬  UNIX V.

            #include<stdarg.h>             ॡ          
                                           ᮢ⨬       
                                           ⠭⮬   ANSI   C.

            void  va_start(arg-ptr);             ⠭
                                           arg-ptr         砫
                                           ᯨ᪠   易⥫
                                           㬥⮢      (⮫쪮
                                            <varargs.h>).

            void va_start(arg-ptr, prev-param);
                                                 ⠭
                                           arg-ptr  砫 ᯨ᪠
                                           易⥫    -
                                           ⮢  (⮫쪮  
                                           <stdarg.h>).

            type va_start(arg-ptr, type);      饭
                                           ⥪饣 㬥

            void va_arg(arg-ptr);            ⠭
                                           arg-ptr

            va_list arg-ptr;               㪠⥫      ᯨ᮪
                                           㬥⮢;
            type                           ⨯       頥
                                           㬥;
            prev-param                     ࠬ, ।襤-
                                           騩             ࢮ
                                           易⥫쭮   -
                                             (⮫쪮   
                                           <stdarg.h>).

            va_alist                        ࠬ  -
                                             㭪樨 (⮫쪮
                                            <varargs.h>).

            va_dcl                              va_alist
                                           (⮫쪮          
                                           <varargs.h>).

               ᠭ.

                va_start, va_arg, va_end ᯥ稢 ᯮᮡ  㯠
           㬥⠬  㭪樨,   ਭ ६ ⢮
         㬥⮢.
               㯭  2 ᨨ : ,   <varargs.h>,
          ᮢ⨬  । ⥬ UNIX 5,  , -
           <stdarg.h>,  ਢ  ᮮ⢥⢨  ⠭-

         ⮬ ANSI C.
                ᨨ  ।,  㭪 ਭ 䨪-
         ஢ ᫮ ॡ㥬 㬥⮢, ᫥饥  ६ -
          易⥫ 㬥⮢. ॡ㥬 㬥   
         易⥫  ࠬ  㭪権    㯭 १
          ࠬ஢. 易⥫ 㬥 㯭  १  
         <varargs.h>    <stdarg.h>,   ⠭ 㪠⥫ 
          易⥫ 㬥   ᯨ᪥  㬥⮢;  
         㬥  ᯨ᪠  ⠭ 㪠⥫,  ࠡ-
          㬥⮢ 襭.
                 ⥬ UNIX 5,   <varargs.h>, ᯮ-
            .

               1.  ॡ㥬 ࠬ  㭪樨    -
           ᯮᮡ  ࠬ.
               2.  ᫥ ࠬ  㭪樨 ।⠢ ᯨ᮪ -
         易⥫ 㬥⮢.  ࠬ    va_alist
         (  ९⠩      va_list,          ⨯
         va_alist).
               3.  va_dcl  ᫥  㭪樨  ।
         ⮩   ᪮ 㭪樨.     
         ᠭ ࠬ va_alist, 稢饣  窮    ⮩,
         ,  va_dcl    窠  ⮩.
               4.    㭪樨   va_start ⠭ arg-ptr 
         砫 ᯨ᪠ 易⥫ ࠬ஢,  । 㭪-
         樨.  va_start  ᯮ짮 । va_arg, ᯮ-
            ࠧ. 㬥 arg-ptr   ⨯ va_list.
               5.  va_arg 믮 ᫥饥:
               * 頥 祭  ⨯ type  ⮣  ᯮ-
         , ஥ ।  㬥 arg-ptr;
               *  㢥稢 arg-ptr, ⮡ 㪠  ᫥騩 㬥
          ᯨ᪥, ᯮ ࠧ type  । 砫 ᯮ-
          ᫥饣 㬥.
                㭪権  va_arg  ᯮ짮   -
         ⢮ ࠧ, ⮡  ॡ㥬 㬥  ᯨ᪠.
               6.  ᫥ 饭  㬥⮢  va_end ⠭
         㪠⥫  NULL.

               , ।  ⠭⮬  ANSI  C      
         <stdarg.h>,  ⥫쭮 ⫨  ,  
          <varargs.h>.
               1.  ॡ㥬 㬥  㭪樨    -
         ࠬ.  va_dcl  ᯮ    <stdarg.h>.
               2.   va_start ⠭ arg-ptr   易-
         ⥫ 㬥  ᯨ᪠ 㬥⮢,   ।  㭪-
         樨.   㬥   arg-prt      ⨯  va_list.  㬥
         prev-param   ॡ㥬 ࠬ,  ।⢥
         ।襤饣  ࢮ 易⥫쭮 ࠬ  ᯨ᪠ -
         㬥⮢.  va_start   ᯮ짮  ।  va_arg,
         ᯮ㥬   ࠧ.
               3.  va_arg 믮 ᫥饥:
               * 頥 祭 ⨯ type  ⮣ ᯮ, -
         ஥ ।  㬥 arg-ptr.
               *  ⮡ 㪠  ᫥騩 㬥  ᯨ᪥,  㢥-
         稢 arg-ptr  ᯮ ࠧ type    ।  砫

         ᯮ ᫥饣 㬥.
                 㭪権  va_arg  ᯮ짮  -
         ⢮ ࠧ, ⮡  ॡ㥬 㬥  ᯨ᪠.
               4. ᫥ 饭  㬥⮢, va_end ⠭-
          㪠⥫  NULL.

               頥 祭.

                va_arg 頥 ⥪騩 㬥; va_start  va_end
         祭  .
               . ⠪ vfprintf, vprintf, vsprintf.

               ਬ:

                ਢ ⨭ ணࠬ, ᯮ饩 <varargs.h>
          ᮢ⨬  UNIX V.

            #include <stdio.h>
            #include <varargs.h>

            main()
            {
                   int n;
                   .
                   .
                   .
               /* 뢠 㭪 4-  㬥⮢;  ᫥  㬥
          ࠢ -1, ⮡ ⬥  ᯨ᪠ 㬥⮢ */

                   n = average(2, 3, 4, -1);
            printf("Average is: %d\n", n);
                   .
                   .
                   .
               /*  뢠  㭪 5- 㬥⮢; ᫥ 㬥
          ࠢ -1, ⮡ ⬥  ᯨ᪠ 㬥⮢ */

                   n = average(5, 7, 9, 11, -1);
            printf("Average is: %d\n", n);
            }

            average(va_alist)
            va_dcl
              {
                 int i = 0, count = 0, sum = 0;
                 va_list arg_marker;

                 va_start(arg_marker);

               /* 饭 㬥⮢  ਡ  sum,   -
          ᫥ 㬥 -1. */

             for (; (i = va_arg(arg_marker, int)) >= 0;
                         sum+=i, count++)
                              ;

                 return (count ? (sum/count) : count);
              }.


               筠  ணࠬ, १ᠭ  ᮢ⨬ 
         ⠭⮬ ANSI C.

            #include <stdio.h>
            #include <stdarg.h>

            main()
            {
                   int n;
                   .
                   .
                   .
               /* 뢠 㭪 4-  㬥⮢;  ᫥  㬥
          ࠢ -1, ⮡ ⬥  ᯨ᪠ 㬥⮢ */

                   n = average(2, 3, 4, -1);
            printf("Average is: %d\n", n);
                   .
                   .
                   .
               /*  뢠  㭪 5- 㬥⮢; ᫥ 㬥
          ࠢ -1, ⮡ ⬥  ᯨ᪠ 㬥⮢ */

                   n = average(5, 7, 9, 11, -1);
            printf("Average is: %d\n", n);
            }

            average(first)
            int first;
              {
                 int i = 0, count = 0, sum;
                 va_list arg_marker;

                 va_start(arg_marker, first);

               /*   㬥  ਡ    sum    㢥稢
         count; ᫨  㬥 ࠢ -1, ந室  */

                 if (first != -1)
                      sum = first;
                 else
                      return (0);
                 count++;
               /*  饭  ⥫  㬥⮢  ਡ 
         sum,    ᫥ 㬥 -1. */

                 for (; (i = va_arg(arg_marker, int)) >= 0;
                         sum+=i, count++)
                              ;
                 return (sum/count);
              }.




               VFPRINTF - VSPRINTF

            #include <stdio.h>
            #include <varargs.h>    ॡ   ᮢ⨬
                                     UNIX V.

            #include <stdarg.h>     ॡ  ᮢ⨬ 
                                    ⠭⮬ ANSI C.

            int vfprintf(stream, format-string, arg-ptr);
            int vprintf(format-string, arg-ptr);
            int vsprintf(buffer, format-string, arg-ptr);

            FILE *stream;            㪠⥫   
                                     ⨯ FILE.
            char *buffer;                ࠭ १-
                                     
            char *format-string;     ப ࠢ ଠ⮬
            va_list arg-ptr;         㪠⥫     ᯨ᮪  -
                                     ⮢.
               ᠭ.

               㭪樨 vfprintf, vprintf, vsprintf ଠ    뢮
          ᮮ⢥⢥  ⮪ stream, ⮪ ⠭⭮ 뢮 
           buffer.    㭪樨  宦    ᢮   fprintf,
         printf, sprintf,  ᯮ  㪠⥫    ᯨ᮪  㬥⮢
          ᯨ᪠ 㬥⮢.
               Format-string     ᠬ   㭪,   -
         㬥 ப ଠ  㭪樨 printf; (.  ᠭ  㭪樨
         printf).
               ࠬ   arg-ptr      ⨯  va_list,  ।塞  
         <vararg.h>  <stdarg.h>.  ࠬ 㪠뢠  ᯨ᮪  -
         ⮢,  ८ࠧ뢠  뢮 ᮣ᭮ ᮮ⢥-
         騬 ᯥ䨪 ଠ  format-string.

               頥 祭.

               頥  祭  ⢮ 뢥 ᨬ-
         .
               .  ⠪  fprintf,  printf,  sprintf,   va_arg,   va_end,
         va_start.

               ਬ:

                ⢥ ਬ ਢ ⨭ ணࠬ, ᯮ-
         饩 <varargs.h>  ᮢ⨬  UNIX V.

            #include <stdio.h>
            #include <varargs.h>

            main ()
            {

            int line = 1;

            char *filename = "EXAMPLE";
            .
            .
            .
            error("Error: line %d, file %s\n", line, filename);
            .
            .
            .
            error("Syntax error\n");
            }

            error(va_alist);
            va_dcl;
            {
               char *fmt;
               va_list arg_ptr;

                 va_start(arg_ptr);
               /* arg_ptr ᥩ 㪠뢠  ப ଠ */
                 fmt = va_arg(arg_ptr, char *);
               /* arg_ptr ᥩ 㪠뢠  㬥 ᫥ ப ଠ-
          */
                 vprintf(fmt, arg_ptr);
                 va_end(arg_ptr);
            }

             室:

            Error: line 1, file EXAMPLE
            Syntax error.

                 ਢ  筠 ணࠬ, १ᠭ 
         ᮢ⨬  ⠭⮬ ANSI C.

            #include <stdio.h>
            #include <stdarg.h>

            main ()
            {
            int line = 1;
            char *filename = "EXAMPLE";
            .
            .
            .
            error("Error: line %d, file %s\n", line, filename);
            .
            .
            .
            error("Syntax error\n");
            }

            error(fmt);
            char *fmt;

            {
               va_list arg_ptr;
               va_start(arg_ptr, fmt);


               /* arg_ptr ᥩ 㪠뢠  㬥 ᫥ ப ଠ-
          */
                 vprintf(fmt, arg_ptr);
                 va_end(arg_ptr);
            }

             室:

            Error: line 1, file EXAMPLE
            Syntax error.




               WRITE

            #include<io.h>       ॡ ⮫쪮    
                                 㭪樨

            int write (handle, buffer, count);
            int handle;          handle-, 뫠騩  
                                 䠩
            char *buffer;       뢠 
            unsigned int count; ᫮ ⮢

               ᠭ.

               㭪 write 뢠  count      buffer  
         䠩, 易  handle. 樨 write 稭  ⥪饩 -
         樨  㪠⥫   䠩 (㪠⥫ 樨஢   䠩-
         ). ᫨ 䠩   , 樨 믮  -
          䠩. ᫥ ⢫ 権  㪠⥫   䠩
         (᫨  ) 㢥稢  ⢮ ⢨⥫쭮 ᠭ-
          ⮢.

               頥 祭.

               㭪  write  頥  ᫮  ⢨⥫쭮 ᠭ
         ⮢. 頥 祭   ⥫,  -
          ᫠ count (ਬ,  ࠧ     count  ⮢
         室   । ࠭⢠  ᪥). 頥 祭
         -1 㪠뢠  訡; errno ⠭    ᫥
         祭:

                         

            EACCES           䠩   ⥭   
                             

            EBADF             handle- 䠩


            ENOSPC            ன⢥  ᢮ 

               ᫨  䠩 ᠭ  32  (ᨬ   ࠧ  
         ⨯  int),  頥  祭  㤥  ⨯ unsigned int
         (.᫥騩 ਬ). , ᨬ쭮 ᫮  뢠-
          ⮢  䠩 ࠢ 65534; ᪮ ᫮ 65535  -
         ⫨稬   -1,  頥 訡. ᫨  䠩 -
           ⥪⮢ ०,  ᨬ "ॢ ப"   室
           ன " ⪨-ॢ ப".   
           頥 祭.
               .⠪ fwrite, open, read.

               砭.    䠩,   ⥪⮢  ०,
         ᨬ  ࠪ  ᪨  䠩.    -
         ன⢮ ᨬ     砭 #include<io.h>.

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

            char buffer [60000];

            main ()

               {
               int fh;
               unsigned int nbytes = 60000, byteswritten;

               if ((fh=open("c:/data/conf.dat",O_WRONLY))==-1) {
                   perror("open failed on output file");
                   exit (1);
                   }
               if ((byteswritten=write(fh,buffer,nbytes))==-1)
                   perror ("");
               else
                 printf("Wrote %u bytes to file\n",byteswritten);
               .
               .
               .
               }

