C++ – mkdir, a signed path name

mkdir, a signed path name… here is a solution to the problem.

mkdir, a signed path name

I have a small issue where I need to create a directory from my C code or C++, that’s okay.
But the directory name must contain characters like ‘:’, ‘ ‘, ”.’ At the general current time,
I get an EINVAL error when I try to create with the mkdir() function, but everything works fine from system("mkdir ...").
How do I fix this?

Thank you !!!

Solution

Different file system formats have different rules for what is and is not a valid character. For ext2 and its descendants, the file name can contain any character other than ‘/‘ or ‘\0'.

For FAT file systems and their descendants, the list of invalid characters is larger, including ‘:'.

Check the file system format you are using and try running your program on a different file system.

Related Problems and Solutions