Example
A function which prints the type of the file system object stat'ed:
void list_type (const char* filename)
{
try {
RWFileStat st (filename);
// print type
if (st.isSymlink ())
std::cout << " symlink";
if (st.isFile ())
std::cout << " file";
if (st.isBlock ())
std::cout << " block";
if (st.isDirectory ())
std::cout << " directory";
if (st.isCharacter ())
std::cout << " character";
if (st.isFifo ())
std::cout << " FIFO";
// List the file mode
std::cout << " 0x"
<< std::hex << std::setw (8) << std::setfill('0')
<< st.mode () << std::endl;
}
catch (const RWInternalErr& e) {
std::cerr << " Exception : " << e.why ();
}
catch (...) {
std::cerr << " Unknown exception.";
}
}