> For the complete documentation index, see [llms.txt](https://nelson-9.gitbook.io/nelson/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nelson-9.gitbook.io/nelson/markdown/en/stream_manager/ftell.md).

# ftell

Returns the offset of the current byte relative to the beginning of a file.

## 📝 Syntax

* p = ftell(fid)

## 📥 Input argument

* fid - a file descriptor

## 📤 Output argument

* 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.

## 💡 Example

```matlab
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

[fopen](/nelson/markdown/en/stream_manager/fopen.md), [fprintf](/nelson/markdown/en/stream_manager/fread.md), [fclose](/nelson/markdown/en/stream_manager/fclose.md), [fseek](/nelson/markdown/en/stream_manager/fseek.md).

## 🕔 History

| Version | 📄 Description  |
| ------- | --------------- |
| 1.0.0   | initial version |
