Direct_Output¶
Include: Use System\FileSystem.pkg
See Also: Append_Output, Close_Output, Flush_Output, Write, Write_Line, Write_Block, Seq_New_Channel, Seq_Release_Channel, Sequential Channels
Purpose¶
Creates or truncates a sequential output file.
Syntax¶
Direct_Output [Channel {ChannelNumber}] {FileName}
Direct_Output [Channel {ChannelNumber}] FILE {FileName}
Arguments¶
Channel {ChannelNumber}
: Optional channel selector. Use Seq_New_Channel when opening files in application code; see Sequential Channels.
FILE
: Optional file driver. When omitted, Direct_Output uses FILE.
{FileName}
: The output file. Opening an existing file truncates it.
Example¶
Handle hFile
Get Seq_New_Channel to hFile
Direct_Output Channel hFile FILE "test1.txt"
Write_Line Channel hFile "This is some text."
Close_Output Channel hFile
Send Seq_Release_Channel hFile
Advanced: file-name options¶
Place supported options before the path inside the file-name string. Options are case-insensitive and end with a colon.
Default file handling is binary-style with LF line endings in the current runtime. binary: is accepted but does not change that default. pc-text: opts into CR/LF line handling and is useful when interoperating with files that require CR/LF.
| Option | Behavior |
|---|---|
pc-text: |
Uses CR/LF line handling. |
binary: |
Accepted; does not change the default binary-style/LF behavior. |
cr: <ascii>: |
Sets the character treated as carriage return. |
eol: <ascii>: |
Sets the character treated as end of line. |