chdir() or opendir() first while trying to manipulate a directory?

I’m confused which inbuilt function to use first when you want to manipulate a directory. I have a book that sometimes use chdir() first and sometimes it’s opendir() that’s first in the order.

opendir() = opens a directory
chdir() = changes the directory

So if you are in home and need to get to public_html, you use chdir() and opendir() (is one of a few) to open the path. Otherwise, you would use opendir() with the full path.

I do not understand. Could you give an example using windows file system?

You have examples in your book. Why do you need more? Read the part about what I said they do.

Sponsor our Newsletter | Privacy Policy | Terms of Service