Let's consider the following 3 code lines:
struct stat buffer;
status = lstat(file.c_str(), &buffer);
bool Flag = S_ISREG(buffer.st_mode)
When S_ISREG() returns true
it tells you that the file is a regular file
What does regular means exactly ?
Thanks
A regular file is one type of file stored in a file system. It is called "regular" primarily to distinguish it from other special types of files. Most files used directly by a human user are regular files. For example, executable files, text files, and image files are regular files.
The isDir() function is used to check a given file is a directory or not. Here we used stat() function and S_ISREG() macro.
S_ISLNK() macro can be used for to test whether a directory is symbolic link or it can be used to check only whether a file is symbolic link or not.
It is non-standard, you should check the documentation for your CRT implementation. But it ought to mean that the name refers to a regular file, instead of a pipe, stream, symbolic link, directory or device.
Regular means it's not a directory, not a symlink, not a block device, and not a character device. It's just... regular. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With