    C++__________________________________697

   _creat,     ,
  open.

   close:

int close(int handle);

      ,   hand-
le,   write  read:

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

int read(int handle, void *buf, unsigned len);

   buf    ,     
      len .

    ,   -
,   ,    12.9.2.3,  -
        i  j, 
    s:

ttinclude <stdio.h>
ttinclude <stdlib.h>
ttinclude <fcntl.h>
ttinclude <sys\stat.h>
ttinclude <io.h>
ttinclude <string.h>

int i = 1, j = 25, il, jl;

double a = 25e6, al;

char s[10], si[10] ;

strcpy(s,"");

int handle;

//   

if ((handle = open("Test.txt", 0_WRONLY | 0_CREAT I 0_BINARY)) == -1)

{

ShowMessage("   ");

return;

}

write(handle, &i, sizeof(int));        //  i

write(handle, &j, sizeof(int));        //  j

write(handle, &a, sizeof(double));     //  

write(handle, s, strlen(s)+1);         //   s

close(handle) ;

//   

if ((handle = open("Test.txt", 0_RDONLY | 0_BINARY)) == -1)

(

ShowMessage("   ");

return;

}

read(handle, &il, sizeof(int));         //  i

read(handle, &jl, sizeof(int));         //  j

read(handle, &al, sizeof(double));      //  

readfhandle, si, strlen(s)+1);          //   s

close(handle);

      ,      12.9.2.3, 
,        . -
,         , -
   12.9.2.3,      .

   ,  ,   -
 tell  Iseek,     12.9.2.3  ftell 
fseek,     .   