Main Content

Low-Level File I/O

Read and write operations at the byte or character level

Open, close, read, write, and navigate binary and text files at the byte and character levels. To work with files at the variable level, see Supported File Formats for Import and Export.

Functions

expand all

fopenOpen file or obtain information about open files
fcloseClose one or all open files
freadRead data from binary file
fscanfRead data from text file
fgetlRead line from file, removing newline characters
fgetsRead line from file, keeping newline characters
filereadRead contents of file as text
openedFilesFile identifiers of all open files (Since R2024a)
ferrorFile I/O error information
ftellCurrent location of file position pointer in file
fseekMove file position pointer to specified position in file
frewindMove file position pointer to beginning of open file
feofTest for end of file
fwriteWrite data to binary file
fprintfWrite data to text file

Topics