How to test whether a given path is a directory or a file in C++?

How to test whether a given path is a directory or a file in C++?

For example,

pathtype("/") --> "a dir"
pathtype("/tmp/file.txt") --> "a file" # if there is a file file.txt
pathtype("/tmp/dir.txt") --> "a dir" # if there is a dir named dir.txt
asked Dec 21, 2017 by anonymous

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...