ftell
Returns the offset of the current byte relative to the beginning of a file.
📝Syntax
p = ftell(fid)
📥Input Arguments
Parameter Description
fid a file descriptor
📤Output Arguments
Parameter Description
p an integer value: position of the file pointer as the number of characters from the beginning of the file.
📄Description

ftell returns the offset of the current byte relative to the beginning of the file associated with the named stream fid.

💡Examples
TXT = 'example about ftell.';
fileID = fopen([tempdir(), 'ftell.txt'],'wt');
fprintf(fileID, TXT);
p1 = ftell(fileID)
fseek(fileID, SEEK_CUR, 'bof');
p2 = ftell(fileID)
status = fclose(fileID);
🔗See Also
fopenfprintffclosefseek
🕔Version History
Version Description
1.0.0 initial version
Edit this page on GitHub