
raise

㭪            뫠 ணࠬ ᨣ 믮塞 ணࠬ.

⠪          #include<signal.h>
                   int raise(int sig);

, ᮤঠ騩   signal.h
⨯

ᠭ           raise 뫠   ᨣ   sig   ணࠬ.    ᫨
                   ணࠬ  㧨  楤 ࠡ⪨ ᨣ,
                    ᨣ sig,   ᪠  楤.
                   ᫨  楤 ࠡ⪨   ᨣ ,
                    ந ⢨, ।  
                   ᨣ  㬮砭.

                    ᫥騥 ⨯  ᨣ,  ।  
                   䠩 signal.h:

                   
                            祭
                   
                   SIGABRT        ଠ쭮 襭 (*)
                   SIGFPE         ୠ   ᫠ 
                                  饩 窮
                   SIGILL         ୠ  (#)
                   SIGINT         뢠  Ctrl_Break.
                   SIGSEGV            (#)
                   SIGTERM          襭 ணࠬ (*)
                   

                    祭  (*)      DOS 
                   Borland C++,   ६ ଠ쭮  ࠡ.  
                      ஢   㭪樨 raise.
                    祭  (#)      ஢
                   ᨭ஭  ࠬ  8088    8086,  
                       ஢     묨     㣨
                   ࠬ (ᬮ signal).

頥        ᯥ譮 襭 raise 頥 0,  -
祭           ⨢ 砥 㫥 祭.

७ᨬ      raise ন ⥬ UNIX   ⠭⮬
                   ANSI C.

 ⠪     abort, signal.

ਬ:

#include<signal.h>
int main()
{
int a,b;

a = 10;
b = 0;
if(b==0)
/* । 訡    0 */
   raise(SIGFPE);
a = a / b;
return 0;
}


rand

㭪             砩 ᥫ.

⠪          #include<stdlib.h>
                   int rand(void);

, ᮤঠ騩   stdlib.h
⨯

ᠭ           㭪 rand      ᯮ     ⨯⨢
                     砩 ᥫ   ਮ
                   2^32,   ⮡    ᥢ砩  ᫠  
                        0      RAND_MAX.   ᪠
                   ⠭   RAND_MAX  ।    stdlib.h;  
                   祭 2^15-1.

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

 ⠪     random, randomise, srand.

ਬ:

#include <stdio.h>
#include <stdlib.h>
int main(void)
{
   int i;
   printf("10 砩 ᥫ  0  99 \n\n");
   for (i=0; i<10; i++)
       printf("%d\n", rand()%100);
   return 0;
}


randbrd

㭪            ⥭  ᪠.

⠪          #include <dos.h>
                   int randbrd(struct fcb *fcbptr, int recent);

, ᮤঠ騩   dos.h
⨯

ᠭ           㭪 randbrd    뢠    recent    ᥩ,
                   ᯮ  FCB,  㥬 㪠⥫ fcbptr.
                     뢠       ⥪饬 
                   DTA.  뢠  ᪠, 祬 ଠ
                         random  record   FCB.  
                    믮    ⥬  맮
                   DOS 0x27.

                   ⢨⥫쭮 ᫮   ⠭   ᥩ   
                   ।   ஠஢    random  record
                     FCB.      ᫥  樨   㤥
                      ଠ樥      ᫥  ⢨⥫쭮
                   ⠭ ᥩ.

頥        ᨬ  १ ࠡ 㭪権 randbrd
祭           頥 ᫥騥 祭:

                   0-   ⠭;

                   1- ⨣  䠩 (EOF)  ᫥ 
                      ⠭ ;

                   2- ⠭   ᯮ 冷 
                      ᮬ 0xFFFF (⠭ ᥩ ⮫쪮,
                      ᪮쪮 ).

                   3- ⨣  䠩  ᫥  -
                      ⠭  .


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

 ⠪     getdta, randbwd, setdta.

ਬ:

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

int main(void)
{
   char far *save_dta;
   char line[80],buffer[256];
   struct fcb blk;
   int i,result;
   /*   䠩 */
   printf(" ன⢮   䠩 ( , ਬ\
           a:file.dat)\n");
   gets(line);
   /*   䠩  FCB */
   if(!parsfnm(line,&blk,1))
   {
      printf("訡  맮 parsfnm\n");
      exit(1);
   }
   printf("ன⢮ #%d 䠩: %s\n\n",blk.fcb_drive, blk.fcb_name);
   /*  䠩,  ᯮ짮 㭪権 DOS, ࠡ  FCB */
   bdosptr(0x0f,&blk,0);
   /* ࠭  DTA, ᮧ  */
   save_dta = getdta();
   setdta(buffer);
   /* ।  FCB ଠ  DTA */
   blk.fcb_recsize = 128;
   blk.fcb_random = 0L;
   result = randbrd(&blk,1);
   /* ஢ १ 樨 */
   if(!result)
      printf("⥭ 祭 ᯥ譮\n");
   else
   {
     perror("訡,  ६ ⥭ \n");
     exit(1);
   }
   /*     DTA */
   printf(" 128 ᨬ:\n);
   for(i=0; i<128; i++)
      putchar(buffer[i]);
   /* ⠭ DTA */
   setdta(save_dta);
   return 0;
}


randbwr

㭪              .

⠪          #include <dos.h>
                   int randbwr(struct fcb *fcbptr, int reccnt);

, ᮤঠ騩   dos.h
⨯

ᠭ           㭪 randbwd    뢠    recent   ᥩ,
                   ᯮ  FCB,  㥬 㪠⥫ fcbptr.
                       믮      ⥬
                   맮 DOS 0x28.

                   ⢨⥫쭮 ᫮   ᠭ   ᥩ  
                   ।  ஠஢    random   record
                      FCB.      ᫥  樨  㤥
                     ଠ樥      ᫥   ⢨⥫쭮
                   ᠭ ᥩ.

頥        ᨬ  १ ࠡ 㭪権 randbwd
祭           頥 ᫥騥 祭:

                   0-   ᠭ;

                   1-  ᪥     . ( -
                      ᠭ   .)

                   2- 뢮  ᯮ 冷  ᮬ
                      0xFFFF (뢥 ᥩ ⮫쪮, ᪮쪮 -
                      ).

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

 ⠪     randbrd.

ਬ:

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

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


random

㭪             砩 ᥫ.

⠪          #include<stdlib.h>
                   int random(int num);

, ᮤঠ騩   stdlib.h
⨯

ᠭ           㭪 random   頥   砩   ᫮  
                     0  num-1.  random(num)    ,
                   ।         (rand()%num).    num  
                   頥 祭 楫.

頥       random 頥 砩 ᫮   
祭           0  num-1.

७ᨬ      ⢥ 㭪   Turbo Pascal.

 ⠪     rand, randomise, srand.

ਬ:

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

int main(void)
{
   randomize();
   printf("砩 ᫮    0  99:", random(100));
   return 0;
}


randomize

㭪            樠  砩 ᥫ.

⠪          #include<stdlib.h>
                   #include<time.h>
                   void randomize(void);

, ᮤঠ騩   stdlib.h
⨯

ᠭ           㭪 randomize     樠     
                   砩  ᥫ  砩 ᫮.  ..
                   randomize    ,  ஥  ᯮ  맮
                   㭪樨  time,      ४㥬  ⠪
                   䠩 time.h  ᯮ짮 ⮩ 㭪樨.

頥       .
祭

७ᨬ      ⢥ 㭪   Turbo Pascal.

 ⠪     rand, random, srand.

ਬ:

#include <stdio.h>
#include <stdlib.h>
int main(void)
{
   int i;
   randomize();
   printf("10 砩 ᥫ  0  99 \n\n");
   for (i=0; i<10; i++)
       printf("%d\n", rand()%100);
return 0;
}


_read

㭪            뢠   䠩.

⠪          #include<io.h>
                   int _read(int handle, void *buf, unsigned len);

, ᮤঠ騩   io.h
⨯

ᠭ
                   㭪 _read    len    
                   䠩,  易  handle,   ,  㥬
                   ࠬ஬    buf.    㭪    _read    
                   ।⢥ 맮 樨 ⥭ DOS.

                    䠩, ⮬  ⥪⮢ ०, 㭪 read
                    㤠 ᨬ " ⪨".

                   ࠬ handle -    ᠬ  ࠬ,  
                     室 㭪権 creat, open, dup, dup2.

                   㭪 _read 稭 ⥭  ⥪饣 
                   㪠⥫ 樨  䠩.  ⥭ 襭,
                   㭪   㢥稢  㪠⥫  䠩    ᫮
                   ⠭ .  ࠡ 㭪権  ன⢠,
                         뢠   ।⢥   
                   ன⢠.

                   _read      ࠧ    65534  ,
                   ᪮ 65535 (0xFFFF)  -1,  訡.

頥        ᯥ譮 襭 頥 ⥫쭮
祭           楫 ᫮, 饥 ᫮ ⮢, 饭
                    ;    䠩 (EOF), 㭪 頥
                   .  訡 _read 頥 -1,  쭮
                   ६  errno  ᢠ     ᫥
                   祭:

                       EACCES -  饭.
                       EBADF -    䠩.

७ᨬ     _read 㭨쭠  DOS.

 ⠪    _open, read, _write.

ਬ:

#include<stdio.h>
#include<io.h>
#include<alloc.h>
#include<fcntl.h>
#include<process.h>
/* #include<sys\stat.h> */

int main(buffer)
{
   void *buf;
   int handle,bytes;
   buf = malloc(10);
   /*   ⥪饩 ४ਨ 䠩   TEST.$$$ 
      ⪠ ⥭   10 . । ᪮ ⮩
      ணࠬ 室 ᮧ 䠩 TEST.$$$ */
   if((handle = open("TEST.$$$",O_RDONLY|O_BINARY))== -1)
   {
      printf("訡  ⨨ 䠩.\n");
      exit(1);
   }
   if((bytes = _read(handle,buf,10))==-1)
   {
      printf("訡 ⥭.\n");
      exit(1);
   }
   printf("⠭ %d .\n",bytes);
   return 0;
}


read

㭪            뢠   䠩.

⠪          #include<io.h>
                   int read(int handle, void *buf, unsigned len);

, ᮤঠ騩   io.h
⨯

ᠭ           㭪 read     len    
                   䠩,  易  handle,   ,  㥬
                   ࠬ஬ buf.

                    䠩, ⮬  ⥪⮢ ०, 㭪 read
                   㤠 ᨬ " ⪨"  뤠  "
                   䠩" (EOF),  ⨦ ᨬ Ctrl-Z.

                   ࠬ handle  -    ᠬ ࠬ,  
                     室 㭪権 creat, open, dup, dup2.

                   㭪 稭 ⥭ ᪮ 䠩  ⥪饣
                    㪠⥫ 䠩.  ⥭ 襭,
                     㭪  㢥稢  㪠⥫  䠩  
                   ᫮   ⠭   .    ࠡ  㭪樨  
                   ன⢠,               뢠
                   ।⢥  ன⢠.

                   ᨬ쭮, read    65534 ,  ..
                   65535  -1,  訡.

頥        ᯥ譮 襭 頥 ⥫쭮
祭           楫 ᫮, 饥 ᫮ , 饭
                    ; 祬, ᫨ 䠩 뢠  ⥪⮢
                   ०, 㭪 read  砥 ᨬ "
                   ⪨"    ᨬ  Ctrl-z    ᫮   ⠭
                   ⮢.
                   
                     䠩 (EOF), 㭪 頥 . 
                   訡   㭪   頥   祭   -1,   
                   쭮  ६ errno ᢠ  
                   ᫥ 祭:

                   EACCES - ⪠ 㯠.
                   EBADF  -   䠩.

७ᨬ      㭪 read ন  ⥬ UNIX.

 ⠪     _read, open, write.

ਬ:

#include<stdio.h>
#include<io.h>
#include<alloc.h>
#include<fcntl.h>
#include<process.h>
#include<sys\stat.h>

int main(buffer)
{
   void *buf;
   int handle,bytes;
   buf = malloc(10);
   /*   ⥪饩 ४ਨ 䠩   TEST.$$$ 
      ⪠ ⥭   10 . । ᪮ ⮩
      ணࠬ 室 ᮧ 䠩 TEST.$$$ */
   if((handle = open("TEST.$$$",O_RDONLY|O_BINARY))== -1)
   {
      printf("訡  ⨨ 䠩.\n");
      exit(1);
   }
   if((bytes = read(handle,buf,10))==-1)
   {
      printf("訡 ⥭.\n");
      exit(1);
   }
   printf("⠭ %d .\n",bytes);
   return 0;
}


real

㭪            頥 ⢥  ᭮  ᫠,
                      ८ࠧ   ᫮    筮-筮
                   ஢  ⭮    float,  double    long
                   double.

⠪          ।  complex:     ।  bcd:
                   #include<complex.h>         #include<bcd.h>
                   double real(complex x);     double real(bcd x);

, ᮤঠ騩   complex.h                   bcd.h
⨯

ᠭ           ᭮ ᫮ ⮨    ⢥
                   . real 頥 ⢥ .

                   ஬ ⮣,      ᯮ짮  real   
                   ८ࠧ    ᫠        筮-筮
                   ஢  ᫮ ⨯ float,  double    long
                   double.

頥       ⢥  ᭮ ᫠.
祭

७ᨬ       㭪樨    ॡ   C++      ⮬
                   ७ᨬ.

 ⠪     bcd, complex, imag.

ਬ 1:

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

int main(void)
{
   double x=3.1,y=4.2;
   complex z = complex(x,y);
   cout << "z = " << z << "\n";
   cout << "⢨⥫쭠  = " << real(z) << "\n";
   cout << "  = " << imag(z) << "\n";
   cout << "᭮ ᮯ殮 = " << conj(z) << "\n";
   return 0;
}

ਬ 2:

#include<iostream.h>
#include<bcd.h>

int main(void)
{
   bcd x = 3.1;
   cout << "筮 筮 ᫮ x =" << x << "\n";
   cout << "  : " << real(x) << "\n";
   return 0;
}


realloc

㭪            । .

⠪          #include<stdlib.h>
                   void * realloc(void *block, size_t size);

, ᮤঠ騩   stdlib.h  alloc.h
⨯

ᠭ           realloc ⠥     ᦠ            㢥
                   ।⥫쭮  뤥    ࠧ  size
                   .  㬥 block 㪠뢠      ,
                   祭   맮 㭪権 malloc,  calloc 
                   realloc.  ᫨ block  㫥  㪠⥫,
                   realloc ࠡ⠥ ⠪   malloc.

                   realloc  ࠧ 뤥   
                     室   ᮤন  
                   .

頥       realloc 頥  ,   -
祭             室. ᫨    
                   뤥  size ࠢ 0,    realloc  頥
                   NULL.

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

 ⠪     calloc, farrealloc, free, malloc.

ਬ:

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

int main(void)
{
   char *str;
   /* 뤥   ப */
   str = malloc(10);
   /* ᪮஢  ப "Hello" */
   strcpy(str,"Hello");
   /* 뢥 ப */
   printf("ப: %s\n, : %p\n",str,str);
   str = realloc(str,20);
   printf("ப: %s\n,  : %p\n",str,str);
   /* ᢮  */
   free(str);
   return 0;
}


rectangle

㭪             אַ㣮쭨.

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

, ᮤঠ騩   graphics.h
⨯

ᠭ           rectangle    אַ㣮쭨    ⥪饣
                   , ⮫騭  梥.

                   (left, top)-न       孥   㣫
                   אַ㣮쭨,    (right,   bottom)-   ࠢ
                    㣮.

頥       .
祭

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

 ⠪     bar, bar3d, setcolor, setlinestyle.

ਬ:

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

int main(void)
{
/*  ⮮। */
int graphdriver = DETECT, gmode, errorcode;
int left,top,right,bottom;

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

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
left = getmaxx() / 2 - 50;
top = getmaxy() / 2 - 50;
right = getmaxx() / 2 + 50;
bottom = getmaxy() / 2 + 50;
/*  אַ㣮쭨 */
rectangle(left,top,right,bottom);
/* ⪠ */
getch();
closegraph();
return 0;
}


registerbgidriver

㭪             㦥     짮⥫     
                   ஥  ᪮ ࠩ  ᪮
                   ⥬.

⠪          #include <graphics.h>
                   int registerbgidriver(void (*driver)(void));

, ᮤঠ騩   graphics.h
⨯

ᠭ           registerbgidriver  짮⥫ 㧨
                   䠩 ࠩ  "ॣ஢" ࠩ.  
                      ᯮ         㤥   ᮮ饭
                   registerbgidriver,  initgraph ᬮ  ᯮ짮
                   ॣ஢        ࠩ.        ࠩ,
                   ॣ஢   짮⥫,      
                   㦥    ᪠     ,
                      ८ࠧ      .OBJ-䠩   (   
                   BINOBJ.EXE)  祭  .EXE .

                   맮 registerbgidriver  ନ   
                   ⥬   ⮬,   ࠩ driver  祭 
                   ६   .      ணࠬ    ஢
                   易     㪠 ࠩ.  ᫨ 
                   ࠢ,    ॣ   ஥
                   ⠡. 易 ࠩ 뢠 ஡ 
                   䠩 UTIL.DOC.

                   ᯮ   ஥   ࠩ      맮
                   registerbgidriver,           (
                   । 痢 (linker)) ந ꥪ  䠩
                    騬 .

頥       registerbgidriver 頥 ⥫
祭            ᪮ 訡, ᫨ 㪠 ࠩ-
                          묨.    ⨢
                   砥    registerbgidriver    頥    
                   ࠩ.

                   ᫨      ॣ     ࠩ    ᮧ
                   짮⥫,    易   ।   १
                   믮  registerbgidriver    initgraph  
                    ࠩ,  㤥 ᯮ짮.

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

 ⠪     graphresult, initgrsph, installuserdriver,
                   registerbgifont.

ਬ:

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

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

/* ॣ஢ ࠩ,   graphics.lib */
errorcode = registerbgidriver(EGAVGA_driver);
if(errorcode < 0)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}

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

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

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


registerbgifont

㭪             ஥   ᨬ.

⠪          #include <graphics.h>
                   int registerbgifont(void(*font)(void));

, ᮤঠ騩   graphics.h
⨯

ᠭ           맮 registerbgifont   ନ    
                   ⥬  ⮬,   font  祭  ६
                   .   ணࠬ ஢ 易 
                    㪠 . ᫨  ࠢ,  
                   ॣ   ஥ ⠡. ஥
                    뢠 ஡  ࠧ BGIOBJ 䠩
                   UTIL.DOC.

                   ᯮ     ஥         맮
                   registerbgifont,    ( ।
                   痢   (linker))   ந   ꥪ  䠩  
                    .

                   ᫨     ॣ          㦥
                   짮⥫,      易  ।  १
                   믮  registerbgifont    initgraph    
                    ,  㤥 ᯮ짮.

頥       registerbgifont 頥 ⥫
祭            ᪮ 訡, ᫨ 㪠
                       묨.     ⨢  砥
                   registerbgifont          頥          
                   ॣ஢ .

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

 ⠪     graphresult, initgraph, installuserdriver,
                   registerbgidriver, settextstyle.

ਬ:

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

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

/* ॣ஢ ,   graphics.lib */
errorcode = registerbgifont(triplex_font);
if(errorcode < 0)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}

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

/* 祭 १ 樠樨 */
errorcode = graphresult();
if(errorcode != grOk)  /* ᫨ 訡 */
{
   printf("訡 :%s\n",grapherrormessage(errorcode));
   printf(" ⠭   \n");
   getch();
   exit(1);  /* 襭   訡 */
}
midx = getmaxx()/2;
midy = getmaxy()/2;
/*   */
settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);
/* 뢥 ⥪ */
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(midx,midy, "The TRIPLEX FONT");

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


remove

㭪             䠩.

⠪          #include<stdio.h>
                   int remove(const char *filename);

, ᮤঠ騩   stdio.h
⨯

ᠭ           remove 㤠  䠩,    ண  ।
                   ࠬ஬  filename.    ப,  
                    ࠭᫨  맮 unlink. ᫨ 䠩 
                       ।⥫쭮 .

                   砭. ப      䠩  
                     .

頥        ᯥ譮 襭 remove 頥 0. 
祭           訡 頥 -1  ᢠ 쭮 -
                   ६ errno   ᫥ 祭:

                       ENOENT -  䠩  ४ਨ .
                       EACCES -  饭.

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

 ⠪    unlink.

ਬ:

#include<stdio.h>

int main(void)
{
   char file[80];
   /*   㤠塞 䠩 */
   printf("  㤠塞 䠩 */
   gets(file);
   /* 㤠 䠩 */
   if(remove(file)==0)
      printf(" %s 㤠.\n");
   else
      perror("remove");
   return 0;
}


rename

㭪            २뢠 䠩.

⠪          #include<stdio.h>
                   int rename(const char *oldname,
                                                const char *newname);

, ᮤঠ騩   stdio.h
⨯

ᠭ           㭪 rename      䠩   oldname 
                   newname.  ᫨ ᯥ䨪 ᪮  祭  
                     newname,      ⮩ ,    
                   oldname.

                   ४ਨ   (path)  易⥫쭮 
                    ⥬  ᠬ묨,  ⮬ 㭪 rename 
                   ᯮ짮      뫪   䠩     
                   ४ਨ     .   ਬ   蠡   
                   ࠧ蠥.

頥        ᯥ譮 २ 䠩 㭪 rename
祭           頥 0.  砥 訡, 頥 -1, 
                   쭠 ६   errno   砥    
                   ᫥ 祭:

                   ENDENT -    䠩  .
                   EACCES - ⪠ 㯠.
                   ENOTSAM-    ᠬ ன⢮.

७ᨬ      rename ন ⠭⮬ ANSI C.

ਬ:

#include<stdio.h>

int main(void)
{
   char oldname[80],newname[80];
   /*   २뢠 䠩,    */
   printf(" २뢠 䠩:");
   gets(oldname);
   promtf(" :");
   gets(newname);
   if(rename(oldname,newname)==0)
      printf(" २  %s  %s\n",oldname,newname);
   else
      perror("rename");
   return 0;
}


restorecrtmode

㭪            ⠭ -०,   室, 
                    । 맮 initgraph.

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

, ᮤঠ騩   graphics.h
⨯

ᠭ           restorecrtmode ⠭   室    
                   ०,   । 맮 initgraph.

                    㭪    ᯮ짮   ᮢ⭮   
                   setgraphmode    ४祭   ⥪⮢ 
                   ᪨ ०.  㭪 textmode   
                   ᯮ짮      楫;  ᯮ
                   ⮫쪮  ᫨  ࠭  㦭  ॢ     
                   ⥪⮢ ०  㣮 ⥪⮢ ०.

頥       .
祭

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

ਬ:

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

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

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

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

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


rewind

㭪            ⠭ 㪠⥫  砫 ⮪.

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

, ᮤঠ騩   stdio.h
⨯

ᠭ           rewind(stream) ⭮    fseek(stream,   0L,
                   SEEK_SET),    ᪫祭   ⮣,      rewind
                     ਧ    䠩    訡,   
                   ६,   fseek   ⮫쪮  ਧ  
                   䠩.

頥       .
祭

७ᨬ      rewind 㯭   ⥬ UNIX  ন-
                    ⠭⮬ ANSI C.

 ⠪     fopen, fseek, ftell.

ਬ:

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

int main(void)
{
   FILE *fp;
   char *fname = "TXXXXXX",*newname,first;
   newname = mktemp(fname);
   fp = fopen(newname,"w+");
   fprintf(fp,"abcdefghijklmnopqrstuvwxyz");
   rewind(fp);
   fscanf(fp,%c,&first);
   printf(" ᨬ: %c",first);
   fclose(fp);
   remove(nemname);
   return 0;
}


rmdir

㭪             ४.

⠪          #include<stdio.h>
                   int rmdir(const char *path);

, ᮤঠ騩   dir.h
⨯

ᠭ
                   rmdir 㤠 ⠫,   ன  㪠  
                   path. ⠫  path:

                   -   .

                   -    ⥪騬 ࠡ稬 ⠫.

                   -    ୥ ⠫.

頥       rmdir 頥 0, ᫨ ⠫  ᯥ譮
祭           㤠.  訡 頥 -1  ᢠ
                   쭮 ६   errno      ᫥
                   祭:

                   EACCES -  饭.
                   ENOENT -   䠩  .

 ⠪     chdir, getcurdir, getcwd, mkdir.

ਬ:

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

int main(void)
{
   int stat;
   stat = mkdir("DIRNAME");
   if(!stat)
      printf("४ ᮧ\n");
   else
   {
      printf("  ᮧ ४\n");
      exit(1);
   }
   getch();
   system("dir /p");
   getch();
   stat = rmdir(DIRNAME);
   if(!stat)
      printf("४ 㤠\n");
   else
   {
      perror("\n  㤠 ४\n");
      exit(1);
   }
   return 0;
}

_rotl

㭪            ᪨ ᤢ  楫  .

⠪          #include<stdlib.h>
                   unsigned _rotl(unsigned value, int count);

, ᮤঠ騩   stdlib.h
⨯

ᠭ           _rotl ந 横᪨ ᤢ 祭  value
                     count ࠧ冷. value ᬠਢ 
                   楫  .

頥       _rotl 頥 value ᤢ⮥ 横᪨ 
祭           count ࠧ冷.

७ᨬ      _rotl 㭨쭠  DOS.

 ⠪     _lrotl, _lrotr, _rotr.

ਬ:

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

int main(void)
{
   unsigned value,result;
   value = 32767;
   result = _rotl(value,1);
   printf("祭 %u ᤢ⮥   ࠧ  = %u",
              value,result);
   return 0;
}


_rotr

㭪            ᪨ ᤢ ࠢ 楫  .

⠪          #include<stdlib.h>
                   unsigned _rotr(unsigned value, int count);

, ᮤঠ騩   stdlib.h
⨯

ᠭ           _rotr ந  横᪨ ᤢ 祭 value
                   ࠢ  count  ࠧ冷.  value  ᬠਢ
                    楫  .

頥       _rotr 頥 value ᤢ⮥ 横᪨ 
祭           count ࠧ冷.

 ⠪     _lrotl, _lrotr, _rotl.

ਬ:

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

int main(void)
{
   unsigned value,result;
   value = 32767;
   result = _rotr(value,1);
   printf("祭 %u ᤢ⮥   ࠧ ࠢ = %u",
              value,result);
   return 0;
}

