Built-in Functions
Structures
Built-in Variables and Constants
Conventions
Exchanges
File.write
Write string data to a file.
write(data)Examples
Writing trade records
javascript
function main() {
let file = os.open("trades.log", "a")
let timestamp = new Date().toISOString()
let tradeInfo = `${timestamp},BUY,50000,1\n`
let bytes = file.write(tradeInfo)
Log("Trade record written, bytes:", bytes)
file.close()
}Returns
| Type | Description |
number | Returns the actual number of bytes written. |
Arguments
| Name | Type | Required | Description |
data | string | Yes | The string data to be written. |
See Also
Remarks
Writes string data to the current position in the file.