evghin
evghin

Reputation: 47

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!!!

Upvotes: 3

Views: 1144

Answers (1)

Robᵩ
Robᵩ

Reputation: 168696

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.

Upvotes: 4

Related Questions