lines ← {tabs←0 {ctype←80}} ##.getfile filename  ⍝ Text file ⍵ as nested vector.

NB: this function is largely superseded by system function ⎕NGET.

Returns  text  file  as a vector of character vectors using default ASCII to ⎕AV
(or  current  ⎕nxlate 0 mapping if this has been changed), translation. The file
content  is  split  at [LF] chars, and [CR] chars are removed.

Optional  left  argument {tabs} specifies tabstop positions for tab expansion. A
value  greater than 0 (the default) causes horizontal tab characters in the file
to be replaced with an appropriate number of blanks in the result.

Optional  left argument {ctype} specifies the type of characters to be read from
the  file. In pre-unicode versions of the interpreter, this would always be left
to default or set to 82. In unicode interpreters, the default is 80 but it could
be set to 160 or 320.

Note  that tabs can be expanded after reading the file, using →xtabs←¨, but this
is not quite as fast.

Example:

      {⎕←⍵}¨12↑8 getfile'c:/dyalog90/aplfmt/default.dft'
+-----------------------------------------------+
+            D a t e   F o r m a t s            +
+-----------------------------------------------+

D:Sunday
D:Monday Tuesday Wednesday Thursday Friday
D:Saturday

M:January       February        March
M:April         May             June
M:July          August          September
M:October       November        December

See also: putfile xtabs utf8get

Back to: contents

Back to: Workspaces