> if the filename has multibyte charset, the filesource will crash.....
> who can tell me why,thanks!
>
> /////follow code is test
> string filename = "C:\\Documents and Settings\\Administrator\\桌面\
> \1.exe";
>
>       auto_ptr<HashTransformation> hash;
>       hash.reset(new CRC32);
>
>       string strDigest;
>       FileSource f(filename.c_str(), true, new HashFilter(*hash,      new
> HexEncoder(new StringSink(strDigest))));
>   
filename.c_str() is your problem. Or rather the assignment. I'm 
surprised that even compiles. I guess your source file is saved in UTF8 
or something.

Even this line should crash:

cout << filename << endl;

Anyway, if you only need to support windows, you can set you project to 
compile in Unicode, then use wchar_t for filename (wchar_t* filename = 
L"path";). Then use a C runtime call to get a FILE descriptor (wfopen() 
or something), then use descriptor to create fstream object (this is non 
standard windows extension to fstream). Then you can pass fstream to the 
FileSource.

Say thanks to whoever does C++ standardization for screwing up 
wchar_t... :(

--~--~---------~--~----~------------~-------~--~----~
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.
-~----------~----~----~----~------~----~------~--~---

Reply via email to