Check that file exists: Difference between revisions
Content added Content deleted
m (Adjusted text formatting issues.) |
m (Improved grammar in comments.) |
||
Line 967: | Line 967: | ||
===Using C++ 17=== |
===Using C++ 17=== |
||
C++ 17 contains a Filesystem library which significantly improves |
C++ 17 contains a Filesystem library which significantly improves operations with files. |
||
<syntaxhighlight lang="c++"> |
<syntaxhighlight lang="c++"> |
||
Line 987: | Line 987: | ||
int main() { |
int main() { |
||
file_exists(" |
file_exists("input.txt"); |
||
file_exists(" |
file_exists("zero_length.txt"); |
||
file_exists(" |
file_exists("docs/input.txt"); |
||
file_exists(" |
file_exists("docs/zero_length.txt"); |
||
} |
} |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
{{ out }} |
{{ out }} |
||
</pre> |
</pre> |
||
" |
"input.txt" exists with a file size of 11 bytes. |
||
" |
"zero_length.txt" exists with a file size of 0 bytes. |
||
" |
"docs/input.txt" exists with a file size of 11 bytes. |
||
" |
"docs/zero_length.txt" exists with a file size of 0 bytes. |
||
</pre> |
</pre> |
||