I'm a beginner and I am making a code about getting the directory of a file, but I have something that I don't understand.
What's the meaning of "./" in DS = opendir ("./");
I have searched a lot of sites about C programming, but nothing gave me a good explanation. I have to present my code soon, forcing me to explain every single line of my code. Please help me. Thanks!
./
is a relative path which is relative to the current working directory of your process.
In computing, the working directory of a process is a directory of a hierarchical file system, if any, dynamically associated with each process. When the process refers to a file using a simple file name or relative path (as opposed to a file designated by a full path from a root directory), the reference is interpreted relative to the current working directory of the process.
So suppose the working directory of your process is /foo
, when you open ./
with opendir
, you are actually opening /foo/./
which is equal to /foo
.