System Function Native Files
⎕NAPPEND
|
||||
L is an arbitrary (but simple homogeneous) array. | ||||
R is a numeric scalar or one- or two-element vector. | ||||
Z is a numeric scalar of the offset in the file of the next byte after the data just appended. |
The first item in R is the tie number of a file created/opened by ⎕NCREATE or ⎕NTIE; the optional second element is the File Conversion code used to convert the data in L before writing it to the file. The File and Workspace Conversion codes are as follows:
Numeric Value |
Character Name |
Datatype | File(F) or Workspace(W) |
110 | 'bool' | 1-bit Boolean | FW |
811 | 'char8' | 8-bit character | F |
1611 | 'char16' | 16-bit character | FW |
3211 | 'char32' | 32-bit character | F |
812 | 'int8' | 8-bit integer | F |
1612 | 'int16' | 16-bit integer | F |
3212 | 'int32' | 32-bit integer | F |
6412 | 'int64' | 64-bit integer | FW |
6413 | 'flt64' | 64-bit float | FW |
You may use either the numeric value or upper-/lower-case character name to identify the conversion code.
If the file conversion code is omitted, then the corresponding code specified implicitly or explicitly when the file was most recently created or opened is used.
For example:
tn←'C:\foo' ⎕ncreate 0 ⍝ Implicit file conversion code of 'char8' and workspace conversion code of 'char16'
'Now is the time ' ⎕nappend tn
After which the file data consists of
0 1 2 3 4 5 6 7 8 9 A B C D E F |4E|6F|77|20|69|73|20|74|68|65|20|74|69|6D|65|20| Now is the time
'Now is the time ' ⎕nappend tn 'char16'
After which the file data consists of
0 1 2 3 4 5 6 7 8 9 A B C D E F |4E|6F|77|20|69|73|20|74|68|65|20|74|69|6D|65|20| Now is the time |4E|00|6F|00|77|00|20|00|69|00|73|00|20|00|74|00| N o w i s t |68|00|65|00|20|00|74|00|69|00|6D|00|65|00|20|00| h e t i m e
If the workspace data (in L) is wider than the width specified by the file conversion code and it cannot be truncated at the high end without losing data, then a DOMAIN ERROR is signalled. For example, if the data in L is character ('char16') and the file conversion code is one of 'char8', 'int8', or 'bool', then enough of the high-order bits of each character in L must be zero so that the actual value fits without loss of data.
For example:
tn←'C:\foo' ⎕ncreate 0
'⊤○⍵ ⍳⌈ ∼∆∊ ∼⍳⍦∊ ' ⎕nappend tn
DOMAIN ERROR
'⊤○⍵ ⍳⌈ ∼∆∊ ∼⍳⍦∊ ' ⎕nappend tn
∧
'⊤○⍵ ⍳⌈ ∼∆∊ ∼⍳⍦∊ ' ⎕nappend tn 'char16'
After which the file data consists of
0 1 2 3 4 5 6 7 8 9 A B C D E F |A4|22|CB|25|75|23|20|00|73|23|08|23|20|00|3C|22| ⊤○⍵ ⍳⌈ ∼ |06|22|0A|22|20|00|3C|22|73|23|66|23|0A|22|20|00| ∆∊ ∼⍳⍦∊
⎕NCREATE
|
||||
L is a character scalar or vector. | ||||
R is a numeric scalar or one-, two-, or three-element vector. | ||||
Z is a numeric scalar of the tie number of the file. |
⎕NERASE
⎕NREAD
⎕NRENAME
⎕NREPLACE
⎕NRESIZE
⎕NSIZE
⎕NNAMES
⎕NNUMS
⎕NTIE
|
||||
L is a character scalar or vector. | ||||
R is a numeric scalar or one-, two-, or three-element vector. | ||||
Z is a numeric scalar of the tie number of the file. |