---
id: "M:cAlgo.API.File.ReadAllText"
kind: "method"
type: "T:cAlgo.API.File"
url: "https://help.ctrader.com/ctrader-algo/references/Utility/File/ReadAllText/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# File.ReadAllText

Member of [File](https://help.ctrader.com/ctrader-algo/references/Utility/File/index.md).

## ReadAllText()

Reads all the text in the file.

Environments: Desktop supported · CLI supported · Cloud not supported.

- Cloud: Exists returns false; reads return empty string/array; writes and appends silently do nothing. No exception.

C#:

```csharp
string ReadAllText()
```

Python:

```python
file.ReadAllText() -> str
```

### Returns

`string` — string

Available since cAlgo.API 5.7.

### Examples

C#:

```csharp
protected override void OnStart()
{
    var text = DataFile.ReadAllText();
    Print("File content: {0}", text);
}
```

Python:

```python
text = api.DataFile.ReadAllText()
api.Print(f"File content: {text}")
```

config.json:

```json
{
  "Parameters": [
    {
      "Name": "DataFile",
      "DisplayName": "Data File",
      "Type": "File"
    }
  ]
}
```

## ReadAllText(EncodingType encodingType)

Reads all the text in the file that has a specified encoding.

Environments: Desktop supported · CLI supported · Cloud not supported.

- Cloud: Exists returns false; reads return empty string/array; writes and appends silently do nothing. No exception.

C#:

```csharp
string ReadAllText(EncodingType encodingType)
```

Python:

```python
file.ReadAllText(encodingType: EncodingType) -> str
```

### Parameters

- `encodingType` (`EncodingType`, Python `EncodingType`): Encoding type

### Returns

`string` — string

Available since cAlgo.API 5.7.

### Examples

C#:

```csharp
protected override void OnStart()
{
    var text = DataFile.ReadAllText(EncodingType.Latin1);
    Print("File content: {0}", text);
}
```

Python:

```python
text = api.DataFile.ReadAllText(EncodingType.Latin1)
api.Print(f"File content: {text}")
```

config.json:

```json
{
  "Parameters": [
    {
      "Name": "DataFile",
      "DisplayName": "Data File",
      "Type": "File"
    }
  ]
}
```

