# fgetl

Read string from a file without newline.

## 📝 Syntax

* res = fgetl(f)

## 📥 Input argument

* f - a file descriptor

## 📤 Output argument

* res - a string or -1

## 📄 Description

Read string from a file, stopping after a newline or EOF have been read.

If there is no more character to read, fgets will return -1.

newline character removed of the string returned

characters encoding uses fopen parameter.

## 💡 Example

```matlab
fid = fopen([nelsonroot(), '/etc/startup.m']);

tline = fgetl(fid);
while ischar(tline)
    disp(tline)
    tline = fgetl(fid);
end

fclose(fid);
```

## 🔗 See also

[fclose](/nelson/markdown/en/stream_manager/fclose.md), [fopen](/nelson/markdown/en/stream_manager/fopen.md), [fgets](/nelson/markdown/en/stream_manager/fgets.md).

## 🕔 History

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nelson-9.gitbook.io/nelson/markdown/en/stream_manager/fgetl.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
