stdio.h >> fcloseall function

January 4, 2010 No Comments » Hits : 280





What it does ?
  • Closes all open streams
Declaration :
  • int fcloseall(void);
Remarks:
  • fcloseall closes all open streams except stdin, stdout, stdprn, stderr, and stdaux.
Return Value:
         ■ On success, returns the total number of streams it closed
         ■ On error, returns EOF
Program :
#include {     int streams_closed;

    /* open two streams */    fopen("temp.ONE", "w");    fopen("temp.TWO", "w");

    /* close the open streams */    streams_closed = fcloseall();

    if (streams_closed == EOF)       /* issue an error message */       perror("Error");    else       /* print result of fcloseall() function */       printf("%d streams were closed.n", streams_closed);

    return 0; }


Bookmark & Share

Incoming search terms: