File.ReadAllText
method · File · cAlgo.API Since 5.7
DesktopCLICloud
Reads all the text in the file.
Environment behaviour
Cloud — not supported. Exists returns false; reads return empty string/array; writes and appends silently do nothing. No exception.
Overloads
| Signature | Description |
|---|---|
ReadAllText() | Reads all the text in the file. |
ReadAllText(EncodingType encodingType) | Reads all the text in the file that has a specified encoding. |
ReadAllText()
Reads all the text in the file.
string ReadAllText()
file.ReadAllText() -> str
Returns string — string
Examples
protected override void OnStart()
{
var text = DataFile.ReadAllText();
Print("File content: {0}", text);
}
text = api.DataFile.ReadAllText()
api.Print(f"File content: {text}")
{
"Parameters": [
{
"Name": "DataFile",
"DisplayName": "Data File",
"Type": "File"
}
]
}
ReadAllText(EncodingType encodingType)
Reads all the text in the file that has a specified encoding.
string ReadAllText(EncodingType encodingType)
file.ReadAllText(encodingType: EncodingType) -> str
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
encodingType | EncodingType | EncodingType | Encoding type |
Returns string — string
Examples
protected override void OnStart()
{
var text = DataFile.ReadAllText(EncodingType.Latin1);
Print("File content: {0}", text);
}
text = api.DataFile.ReadAllText(EncodingType.Latin1)
api.Print(f"File content: {text}")
{
"Parameters": [
{
"Name": "DataFile",
"DisplayName": "Data File",
"Type": "File"
}
]
}