blob: ae0f7e6291a2ca3cf44c51ccd833fb09a5ad01cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
% CPSC-KEYWORD-WRITEFILE(7)
# NAME
cpsc-keyword-writefile - write a line to a text file
# SYNOPSIS
```text
WRITEFILE filename, expression
```
# DESCRIPTION
Write one value as text followed by a newline. Open the file FOR WRITE or APPEND first. Exactly one data expression is accepted; join strings with `&` when needed. Records, classes, and pointers are unsupported as data. An unopened file or a file opened FOR READ throws an exception that TRY/CATCH can handle.
# EXAMPLE
```text
OPENFILE "notes.txt" FOR APPEND
WRITEFILE "notes.txt", "Score: " & NUM_TO_STR(10)
CLOSEFILE "notes.txt"
```
# SEE ALSO
[cpsc-language-overview(7)](../cpsc-language-overview.7.md), [cpsc-keyword-openfile(7)](cpsc-keyword-openfile.7.md), [cpsc-keyword-closefile(7)](cpsc-keyword-closefile.7.md), [cpsc-function-num_to_str(7)](../function/cpsc-function-num_to_str.7.md), [cpsc-keyword-try(7)](cpsc-keyword-try.7.md).
|