Web Development

General discussion


C++ file operations

By amyjobertsch ·
If possible, how do I create directories with C++ code? Also, can I then assign security rights to those directories using C++?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

C++ file operations

by emmenjay In reply to C++ file operations

You cannot create or manage directories using standard, portable, C++. However most C++ compilers provide platform-specific methods to do this.

On a Unix or Linux system you would create a directory using mkdir() and set access permissions usingchmod() and chown().

If you are using VC++ on Windows, you can use _mkdir() to create a directory (or _wmkdir() to create a directory with a Unicode name) and then _chmod() or _wchmod() to set basic access permissions. However, a more flexible way is to use CreateDirectory() which allows you to specify a security descriptor.

Related Discussions

Related Forums