Search code examples
c++gccwchar-tgetcwd

Is there a wchar_t version of getcwd?


I am trying to this:

wchar_t buff[PATH_MAX];
wgetcwd( buff, PATH_MAX);

I have also tried _wgetcwd. Google suggests _wgetcwd is in dir.h, but i have never heard of such a header file.

I'm using GCC 4.3.

Thank you.


Solution

  • If this is a Unix/Linux system there is no point in looking for a wchar_t version of getcwd. That is because all file names and directory names are just bytes with the exception of the '/' and '\0' characters. You can use UTF-8 encoding with them but the filesystem itself does not care.