Linux, like many other operating systems, uses directories to organize files. Directories (which are just special types of files that contain lists of file names) contain files, as well as other directories, allowing a file hierarchy to be built. All Linux systems have a root directory, known as /, through which (directly or indirectly) you access all the files on the system.
getcwd() function allows a process to find the name of its current directory relative to the system’s root directory.
#include <unistd.h> char * getcwd(char * buf, size_t size);
The first parameter,
buf, points to a buffer that is filled in with the path to the current working ...