Skip to content

File.WriteBytes

method · File · cAlgo.API Since 5.7

DesktopCLICloud

Writes a chunk of data to file specific position.

Environment behaviour

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

Definition

void WriteBytes(byte[] bytes, int offset, int count)
file.WriteBytes(bytes: list[int], offset: int, count: int) -> None

Parameters

Name C# type Python type Description
bytes byte[] list[int] Bytes to write
offset int int File byte offset
count int int Count of bytes to write

Examples

protected override void OnStart()
{
    var bytes = Encoding.UTF8.GetBytes(SymbolName);
    DataFile.WriteBytes(bytes, 0, bytes.Length);
}
from System.Text import Encoding

data = Encoding.UTF8.GetBytes(api.SymbolName)
api.DataFile.WriteBytes(data, 0, data.Length)
{
  "Parameters": [
    {
      "Name": "DataFile",
      "DisplayName": "Data File",
      "Type": "File"
    }
  ]
}