Main Page   Namespace List   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

strconv.cpp

Go to the documentation of this file.
00001 #include "stdafx.h"
00002 #define FKSEC_NO_AUTO_INCLUDES 1
00003 #include "fksec.h"
00004 #include "strconv.h"
00005 
00009 
00010 
00016 std::auto_ptr<WCHAR> fksec::Ansi2Unicode(const char * psz)
00017 {
00018     int cb = MultiByteToWideChar ( CP_ACP, 0, psz, -1, NULL, 0 ) ;
00019     std::auto_ptr<WCHAR> szdest ( new WCHAR [cb] ) ;
00020     MultiByteToWideChar ( CP_ACP, 0, psz, -1, szdest.get(), cb ) ;
00021     return szdest ;
00022 }
00023 
00024 
00030 std::auto_ptr<char> fksec::Unicode2Ansi(const WCHAR * psz)
00031 {
00032     int cb = WideCharToMultiByte ( CP_ACP, 0, psz, -1, NULL, 0, NULL, NULL ) ;
00033     std::auto_ptr<char> szdest ( new char[cb] ) ;
00034     WideCharToMultiByte ( CP_ACP, 0 , psz, -1, szdest.get(), cb, NULL, NULL ) ;
00035     return szdest ;
00036 }
00037 
00038 
00041 fksec::fkostream &fksec::operator<<( fksec::fkostream &o, const GUID &g)
00042 {
00043     WCHAR szguid[50] ;
00044     StringFromGUID2(g, szguid, sizeof(szguid)) ;
00045 #ifdef _UNICODE
00046     o << szguid ;
00047 #else
00048     std::auto_ptr<char> pszguid = Unicode2Ansi(szguid) ;
00049     o << pszguid.get() ;
00050 #endif
00051 
00052     return o ;
00053 }

Generated at Mon Oct 16 06:14:07 2000 for fksec by doxygen1.2.2 written by Dimitri van Heesch, © 1997-2000