BeginToLearn
asked on
"." and ".."
Hi,
I need explanation of "." and ".." value in d_name of struct direct when reading directory in Linux . Thanks a lot.
I need explanation of "." and ".." value in d_name of struct direct when reading directory in Linux . Thanks a lot.
ASKER
about DT_DIR? could you explan this
if ( DT_DIR & pEntry->d_type && strcmp ( pEntry->d_name, ".") && strcmp ( pEntry->d_name, ".."))
tks.
if ( DT_DIR & pEntry->d_type && strcmp ( pEntry->d_name, ".") && strcmp ( pEntry->d_name, ".."))
tks.
this condition checks IF the pEntry->d_name value is either "." or ".." , and if the p_entry.d_type is DT_DIR ...
presumable to exclude those from the processing ...
presumable to exclude those from the processing ...
ASKER
i now what it check. but i don't understand the meaning of "." and ".." in this case which is reading directory. thanks.
ASKER
i mean relate to
"." refers to the current directory itself,
".." refers to the parent directory
can u give example?
tks
"." refers to the current directory itself,
".." refers to the parent directory
can u give example?
tks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I understand "." now. It tell where the "dir " command is issued. But why do we need ".."?
any when a program copy a directory ( and its suddirectory ) to another place, do we need to skip "." and ".."? tks.
any when a program copy a directory ( and its suddirectory ) to another place, do we need to skip "." and ".."? tks.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
tks all. I get it now.
".." refers to the parent directory