fclose()

Closes a file.

Synopsis

int fclose( file f );

Parameters

Parameter Meaning
f file to be closed

Return value

EOF in the event of an error -1 otherwise, 0.

Error

Description

Closes the file f and returns EOF in the event of errors, otherwise 0.

Example

main()
{
  file f; // our file
  int err; // error code
  f=fopen("C:/TEMP/TEST.TXT","r"); // open for reading
  err=ferror(f); // export error
  fclose(f); // close file
  if (err!=0) DebugN("Error no. ",err," occurred");
}

Assignment

File functions

Availability

CTRL