The following program demonstrates how to determine a file's type from a struct statbuf's st_mode field using either the S_IF* values or S_IS*() macros.