This week's book giveaway is in the NodeJS forum. We're giving away four copies of Serverless Applications with Node.js and have Slobodan Stojanovic & Aleksandar Simovic on-line! See this thread for details.
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.
The City calls upon her steadfast protectors. Now for a tiny ad:
global solutions you can do at home or in your backyard