tags:

views:

83

answers:

1

There is the POSIX access(), but I'm looking for a wide character version.

+1  A: 

There is no such thing as a "wide-character filename" on Linux. Get the system charset via nl_langinfo() and encode to that charset before calling access().

Ignacio Vazquez-Abrams
Don't forget to `setlocale(LC_ALL, "")` first -- all C programs start in the C locale, you must switch to the environment-specified locale manually.
ephemient
Thanks. In a way this is a pity, 'cos it looks like you can't mix languages when naming files. Can you?
Srikumar
UNIX **filenames** are just a array of bytes, language/encoding is not specified; it's up to each individual application to interpret those bytes however they wish. (Yes, this does seem archaic. That's because it is.) So yes, you could use different encodings for different filenames, but someone else traversing the filesystem would not understand. These days, though, all modern Linux distros use UTF-8 by default -- same encoding regardless of language.
ephemient
Thanks. I don't run linux all that often and this is good to know ... and with a sigh of relief actually.
Srikumar