According to ISO C and POSIX error messages returned by strerror() family should be locale specific. While in my example (Mac OS X 10.10.5 / clang / c11) they are not. I checked several platforms and all of them behave in the same way.
I have checked locales by locale -a
.
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <locale.h>
#include <string.h>
int main(int argc, const char * argv[])
{
setlocale(LC_MESSAGES, "he_IL.UTF-8");
errno = 0;
// Generate unique filename.
FILE *file = fopen(tmpnam((char[L_tmpnam]){0}), "rb");
if (file) {
// Do something useful.
fclose(file);
}
else {
fprintf(stderr, "Error message : %s\n", strerror(errno));
}
return EXIT_SUCCESS;
}
Show:
Error message : No such file or directory