Check that file exists: Difference between revisions

Updated D entry
(Updated D entry)
Line 318:
 
=={{header|D}}==
<lang d>import std.stdio:, writelnstd.file, std.path;
import std.file: exists;
import std.path: sep;
 
void verify(in string name) {
if (name.exists())
writeln("'", name, "' exists");
Line 335 ⟶ 333:
 
// check in root
verify(sepdirSeparator ~ "input.txt");
verify(sepdirSeparator ~ "docs");
}</lang>
{{out}}
<pre>'input.txt' doesn't exist
'docs' doesn't exist
'\input.txt' doesn't exist
'\docs' doesn't exist</pre>
 
=={{header|Delphi}}==