openedFiles - File identifiers of all open files - MATLAB (original) (raw)
Main Content
File identifiers of all open files
Since R2024a
Syntax
Description
fIDs = openedFiles
returns the file identifiers of all open files as a row vector. Files opened for binary read access are assigned integer file identifiers equal to or greater than 3. The identifiers 0
, 1
, and2
, which are reserved for standard input, output, and error, respectively are not included. The number of elements in the vector is equal to the number of open files.
Examples
Get File Identifiers of Open Files
Open two files using fopen
.
fileID1 = fopen("tsunamis.txt"); fileID2 = fopen("outages.csv");
Get the file identifiers of all open files.
Close the files.
fclose(fileID1); fclose(fileID2);
Version History
Introduced in R2024a