What did you already find out? And which operating system is it? For instance, on Linux the system calls is mkdir and on Windows it's CreateDirectoryA or CreateDirectoryW (and there actually a few more as well...).
Minor point - don't use malloc(); just use something like:
Use snprintf() instead of strcpy() and strcat() to avoid destination array overflow eg.:
and you could(/should) use the snprintf() return value to check for truncation.
And there's a bug: is equivalent to:
whereas you want:
If you used gcc with -Wall you would get compiler warning 'assignment makes pointer from integer without cast'.
My pet peeve are messages like "can't create directory" and "can't create file". What file/directory can't you create? The APIs return error codes, use them so I know what the problem is. For example, "can't create /foo/bar/blatz: permission denied". Isn't that much more helpful than "Can't create file"?
Be careful when following the masses, sometimes the m is silent.
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database