3

When I use the file name with colon like 2012-12-12 12:00:00, fopen will be failed and the error is Invalid argument.If I change the file name to 2012-12-12 12-00-00 it goes rightly.What does errno Invalid argument mean? I've tried to run command in Android by adb shell, I tried touch a file with colon in name, it was failed, but If I use vi to new a file with colon in name, it goes rightly.What is the matter with this?And I've check the path, no problem with it.

errno = 0;
FILE *fp = fopen("/sdcard/2012-12-12 12:00:00", "a");
if (fp == NULL) {
    strerror(errno)   // Invalid argument
    return;
}

fprintf(fp, "%s", "something");
fclose(fp);
Suge
  • 2,808
  • 3
  • 48
  • 79

1 Answers1

4

I suppose the problem arises because the colon : is used as a path-list separator under *NIX systems (e.g. to separate the pathnames listed in the PATH environment variable). Probably some internal processing went awry because of this.