Sunday 8 September 2013

Why does fopen thown errno:22 when I use the file name with colon in Android?

Why does fopen thown errno:22 when I use the file name with colon in Android?

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);

No comments:

Post a Comment