fclose

Close an opened file.

Syntax

  • fclose(fid)

  • fclose('all')

  • status = fclose(fid)

  • status = fclose('all')

Input argument

  • fid - a file descriptor

Output argument

  • status - an integer value: 0 if file is closed or -1 if not.

Description

fclose must be used to close a file opened by fopen.

fclose('all') closes all opened file with fopen.

Example

fd = fopen([tempdir(), filesep(), 'fclose_tst'],'wt');
status = fclose(fd)
status = fclose(fd)

See also

fopen, fread, feof.

History

VersionDescription

1.0.0

initial version

Author

Allan CORNET

Last updated