O'Reilly logo

Just Enough C/C++ Programming by Guy W. Lecky-Thompson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating and Deleting Directories

You can create a directory with a very simple function call:

int mkdir ( const char * dir_name )

If the dir_name is not fully qualified, the directory will be created in the current working directory. You can find out which directory that is by calling the getcwd function:

int getcwd ( char * dir_name, int max_length )

The current working directory will then be returned in the dir_name variable. An error value is returned, and the dir_name is set to null if the call fails. You can also change the current working directory by calling chdir:

int chdir ( const char * dir_name )

Again, if the path is not complete, you assume that dir_name exists in the current working directory. To get a list of directories that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required