Next: mem command, Previous: source command, Up: Dot-Commands [Contents][Index]
.file
The .file
command opens a new IO space backed by a file, or
switches to a previously opened file. The syntax is:
.file path
where path is a path to a file to open, which can be relative to poke’s current working directory or absolute.
Tilde expansion is performed in path, much like it’s done in the
shell. This means you can include special characters like ~
(which will expand to your home directory) delimit the file name with
"
in case it includes leading or trailing blank characters,
etc.
When a new file is opened it becomes the current IO space. From that point on, every map executed in the REPL or while loading a Poke program will operate on that IO space:
(poke) .file foo.o The current file is now `foo.o'.
When .file
opens a file, it is opened in whatever mode makes
more sense: if the file allows to be written and read then the IO
space is open in read/write mode, for example.
If the specified file path doesn’t exist then poke emits an error.
However, the flag /c
( for “create”) can be passed to the
command to tell poke it should create a new file.