728x90 개발/C 언어20 you can convert a std::wstring to a const wchar_t * using the c_str member function #include // ... std::wstring wStr; const wchar_t *input = wStr.c_str(); // Count required buffer size (plus one for null-terminator). size_t size = (wcslen(input) + 1) * sizeof(wchar_t); char *buffer = new char[size]; #ifdef __STDC_LIB_EXT1__ // wcstombs_s is only guaranteed to be available if __STDC_LIB_EXT1__ is defined size_t convertedSize; std::wcstombs_s(&convertedSize, buffer, size, input,.. 2023. 2. 9. CString 사용 헤더 #include CString Header: afx.h CStdioFile::CStdioFile wincrypt.h CryptStringToBinaryW 링크에러 1>LIBCMT.lib(vswprnc.obj) : error LNK2005: __vswprintf_c_l already defined in MSVCRTD.lib(MSVCR100D.dll) 프로젝트의 속성에서 Link-> input ->ignort specific library 속성을 LIBCMTD.lib 를 추가 2022. 11. 29. char to LPCWSTR 1 2 3 4 5 6 // char to LPCWSTR void CharToWChar( const char* pstrSrc, wchar_t pwstrDest[] ) { int nLen = ( int )strlen( pstrSrc ) + 1; mbstowcs( pwstrDest, pstrSrc, nLen ); } 1 2 3 4 5 6 // LPCWSTR to char void WCharToChar( const wchar_t* pwstrSrc, char pstrDest[] ) { int nLen = ( int )wcslen( pwstrSrc ); wcstombs( pstrDest, pwstrSrc, nLen + 1 ); } 필수적으로 windows.h 인클루드 해줘야 함 2022. 10. 11. 일정관리 PDM 2022. 10. 7. 이전 1 2 3 4 5 다음 728x90