Qu

make_file

Builtin index · File I/O

make_file(path)

Input: path · Output: no output

What it is

Creates an empty file at path (a Str), truncating it if it is already there — the same promise fopen(path, "w") makes, so the two agree.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
make_file(path)
path Strnot documented yet
no output—

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

mkdir("list_demo")
write_text("list_demo/report.qu", "print(1)")
write_text("list_demo/plot.qu", "print(2)")
write_text("list_demo/notes.txt", "the needle is here")
make_file("list_demo/empty.log")

qu_files = list_files("list_demo", "*.qu")
print("{length(qu_files)} Qu files")

carrying = list_files("list_demo/*", contains = "needle")
for f in carrying
    print("carries the needle: {f}")
end for

blank = list_files("list_demo/*", size = "0")
print("{length(blank)} empty file")
output
2 Qu files
carries the needle: list_demo\notes.txt
1 empty file

from file-io