Code written and tested using the Borland C++ compiler.
Code uses access() to determine if an input string exists either as a directory name or as a file name. If access() fails, the string is neither a file or directory and the function terminates. If it does exist, the name is used as input to opendir() to determine if a directory stream can be opened for that name. If it can, the string is a directory name. Otherwise, it's a file.