Main Content

openedFiles

File identifiers of all open files

Since R2024a

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, and 2, 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.

example

Examples

collapse all

Open two files using fopen.

fileID1 = fopen("tsunamis.txt");
fileID2 = fopen("outages.csv");

Get the file identifiers of all open files.

fIDs = openedFiles
fIDs =

     3     4

Close the files.

fclose(fileID1);
fclose(fileID2);

Version History

Introduced in R2024a

See Also

| | | |