   C++,  C++Builder, API Windows_______________845

 _fsopen   filename    -
 ,   shflag  mode.   -
,     shflag, .   14.12.1. 
mode      fopen.     -
  DOS      SHARE.EXE.

 freopen     stream    filena-
me   mode.    fopen    ,  -
 stream    .  ,  ,  -
 . , 

FILE *F = freopen("output.txt", "wt", stdout);

    stdout    out-
put.txt.      stdout    -
   .

 _fdopen    ,   -
 (       14.12.3)   
FILE. , 

FILE * stream = fdopen(handle, "w");

      handle    stre-
am.

     ,  
 FILE,   _fileno.    
  Test.txt      .

FILE * stream;

int handle;

stream = fopen("Test.txt", "w"); //  
handle = fileno(stream);        //  

fclose(stream);                  //  

    , .. 
     ,    -
,    .   
      ,    , 
 fflush  _flushall.        -
 ,         .  -
    ,      
   ,    .   
      .

     . ,
     setbuf  setvbuf.   
setbuf  buf   NULL,    
 .      ,    
    ,   .   buf
   ,       
   stream    .  
   BUFSIZ,    stdio.h. :

char outbuf[BUFSIZ];

setbuf(F, outbuf);

 setbuf         -
   fseek (.  14.12.4),   -
 .     setbuf    -
 .