Handbook
Glossary
change-file-contents ( ..a path encoding quot: ( ..a seq -- ..b seq' ) -- ..b )
Factor handbook
»
Input and output
»
Reading and writing files
Prev:
set-file-contents ( seq path encoding -- )
Next:
file-lines ( path encoding -- seq )
Vocabulary
io
.
files
Inputs
path
a pathname string
encoding
an encoding descriptor
quot
a
quotation
Outputs
None
Word description
Reads the file, transforms the file contents, and writes it back to the same file name.
Errors
Throws an error if the file cannot be opened for writing.
See also
set-file-lines
,
file-lines
,
change-file-lines
,
set-file-contents
,
file-contents
Definition
USING:
kernel
;
IN:
io.files
:
change-file-contents
( ..a path encoding quot: ( ..a seq -- ..b seq' ) -- ..b )
[
[
file-contents
]
]
dip
compose
[
set-file-contents
]
2bi
;
inline