> I read few article about FileSource class's path problem. > because i have same problem..and > Someone said 'make to new fstream for solving'..like that. > > Here is my sugeestion and proposal. let's discuss about this. > I debug that part, > exactly 'files.cpp' line 163 and 30. > > In this part, std::ofstream used by smartptr template. > yes, smartptr template is normally works well... > > But if user set filename with multi-byte string for file open, > 'if (!*m_file)' <- THIS PART! > this part returning to NULL. > (std::ofstream for working well for any multibyte path) > > What happen on here? if use only just ascii string, works fine. > How can we fix this?
By multi-byte you mean wchar_t*? Or UTF8-encoded char*? std::fstream doesn't take anything but char* for filename, because underneath it uses fopen() to open the file. Even std::wfstreams take char* filename :\. On windows, you can open file with _wfopen() and pass FILE handle back to the stream. But that is windows only hack in STL (maybe MS compilers only). On OSX and Linux you'll have to take wchar_t* path, encode it into UTF-8 char* and use that to create a stream from a file. (same approach doesn't work on windows for some reason -- have to use _wfopen() O_o). Blame C++ standardization committee for major Unicode screw-up :(. (and this is only one issue, the problems with all the different wchar_t sizes are much worse). The fix you came up with might be just happening to work on you system -- test it on different system with different codepage, or test it on a random unicode path. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [EMAIL PROTECTED] More information about Crypto++ and this group is available at http://www.cryptopp.com. -~----------~----~----~----~------~----~------~--~---
