Search code examples
c++clinuxembeddedmkdir

mkdir, pathname with symbol


I have a little problem, I need to make directory from my c code or c++, doesn't matter. But directory name must contain characters like ':', ' ','.' in general current time, when I try to create with mkdir() function I get EINVAL error, but from system("mkdir ...") everything is ok. How can I solve this problem?

Thank you!!!


Solution

  • Different filesystem formats have different rules about what is and is not a valid character. For ext2 and its descendants, A file name may contain any character except for '/' or '\0'.

    For FAT filesystem and its descendants, the list of invalid characters is larger, and includes ':'.

    Check to see what filesystem format you are using, and try running your program on a different filesystem.