How to check if directory exists in C++

The dirent.h header file provides the opendir. Its purpose is to open a directory path to read with other calls. However, this is also a good way to check if the directory exists. If the input directory path does not exist or is a file, then this function return NULL.

Tried with: Ubuntu 14.04

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s