fcloseall

Syntax

int fcloseall()

Arguments

none

Return

Always returns 0.

Description

Closes all opened files and streams, writing any data remaining in the writing buffers to the files and freeing the files for use by other programs.

Example

int inFile, outFile;
if (inFile = fopen("d:\\source.bmp", "rb")) {
  if (outFile = fopen("d:\\destination.bmp", "wb")) {
    while (i = fgetc(inFile)) {
      fputc(i, outFile);
    }
  }
  fcloseall();
}

Also see

fopen, fclose

Comments

Everyone can add his comments about his experiences with this function here. Tips for using it are welcome, too.