cyberfish, the m_fd pointer was indeed NULL. Should have checked that...
Anyway, the file creation itself is failing when using japanese characters when I have the system set to use japanese language. I can still use regular characters with the system set like that and it will work. This is what I do when creating the file, perhaps some of you are familiar with this and what needs to be done when using japanese (double byte) characters?
The functions used here seems to be standard Windows funtionality. Btw, I did not write this myself to start with so I'm not sure what the MultiByteToWideChar function is suppose to do.
PSDFile* PSDOpen(const char *utf8Name)
PSDFile* psdFile = new PSDFile;
if (!psdFile) return NULL;
MultiByteToWideChar(CP_UTF8, 0, utf8Name, -1, wsName, MAX_PATH );
psdFile->m_fd = _wfopen(wsName,L"w+b");