Check that file exists: Difference between revisions
Add lang example
Jazzedpineda (talk | contribs) (Add Plain English) |
(Add lang example) |
||
Line 1,844:
{{VI snippet}}<br/>
[[File:Ensure_that_a_file_exists.png]]
=={{header|Lang}}==
Currently this task is only possible by using Standard Lang and the Lang IO Module.
<syntaxhighlight lang="lang">
# Load the IO module
# Replace "<pathToIO.lm>" with the location where the io.lm lang module was installed to without "<" and ">"
ln.loadModule(<pathToIO.lm>)
$file1 = [[io]]::fp.openFile(input.txt)
[[io]]::fp.existsFile($file1)
[[io]]::fp.closeFile($file1)
$file2 = [[io]]::fp.openFile(/input.txt)
[[io]]::fp.existsFile($file2)
[[io]]::fp.closeFile($file2)
$dir1 = [[io]]::fp.openFile(docs)
[[io]]::fp.existsFile($dir1)
[[io]]::fp.closeFile($dir1)
$dir2 = [[io]]::fp.openFile(/docs)
[[io]]::fp.existsFile($dir2)
[[io]]::fp.closeFile($dir2)
</syntaxhighlight>
=={{header|Lasso}}==
<syntaxhighlight lang="lasso">// local file
|