1 year ago

#388249

test-img

ein supports Moderator Strike

Portably check whether a file is readable

I'm asking the cross-platform version of this question:

C++: How to check if a file/directory is readable? (PHP equivalent: is_readable)

I have a filesystem::path of a file (let's ignore for simplicity the case of directories, symlinks etc.), and I want to determine whether it is readable by my process - but without trying to open it myself.

I want to only use standard-library functions. Can I do this, or will I have to resort to OS-specific calls?

Note I want to be able to tell non-readability apart from other issues such as physical failure during read, non-existence, and such. No-exceptions code is preferable.

c++

path

c++17

readability

std-filesystem

0 Answers

Your Answer

Accepted video resources