本文整理汇总了C++中CharToOemBuffW函数的典型用法代码示例。如果您正苦于以下问题:C++ CharToOemBuffW函数的具体用法?C++ CharToOemBuffW怎么用?C++ CharToOemBuffW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CharToOemBuffW函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vutf8printf
void vutf8printf(FILE *out, const char *str, va_list* ap)
{
#if PLATFORM == PLATFORM_WINDOWS
char temp_buf[32*1024];
wchar_t wtemp_buf[32*1024];
size_t temp_len = vsnprintf(temp_buf, 32*1024, str, *ap);
size_t wtemp_len = 32*1024-1;
Utf8toWStr(temp_buf, temp_len, wtemp_buf, wtemp_len);
CharToOemBuffW(&wtemp_buf[0], &temp_buf[0], wtemp_len+1);
fprintf(out, "%s", temp_buf);
#else
vfprintf(out, str, *ap);
#endif
}
示例2: CharToOemBuffW
void CmdExtract::ConvertDosPassword(Archive &Arc,SecPassword &DestPwd)
{
if (Arc.Format==RARFMT15 && Arc.FileHead.HostOS==HOST_MSDOS)
{
// We need the password in OEM encoding if file was encrypted by
// native RAR/DOS (not extender based). Let's make the conversion.
wchar PlainPsw[MAXPASSWORD];
Password.Get(PlainPsw,ASIZE(PlainPsw));
char PswA[MAXPASSWORD];
CharToOemBuffW(PlainPsw,PswA,ASIZE(PswA));
PswA[ASIZE(PswA)-1]=0;
CharToWide(PswA,PlainPsw,ASIZE(PlainPsw));
DestPwd.Set(PlainPsw);
cleandata(PlainPsw,sizeof(PlainPsw));
cleandata(PswA,sizeof(PswA));
}
}
示例3: utf8print
void utf8print(void* /*arg*/, const char* str)
{
#if PLATFORM == PLATFORM_WINDOWS
wchar_t wtemp_buf[6000];
size_t wtemp_len = 6000-1;
if (!Utf8toWStr(str, strlen(str), wtemp_buf, wtemp_len))
return;
char temp_buf[6000];
CharToOemBuffW(&wtemp_buf[0], &temp_buf[0], wtemp_len+1);
printf(temp_buf);
#else
{
printf("%s", str);
fflush(stdout);
}
#endif
}
示例4: vutf8printf
void vutf8printf(FILE* file, const char* fmt, va_list& args)
{
#if PLATFORM == PLATFORM_WINDOWS
#define BUFFER_LENGTH 32 * 1024
char temp_buf[BUFFER_LENGTH];
wchar_t wtemp_buf[BUFFER_LENGTH];
size_t temp_len = vsnprintf(temp_buf, BUFFER_LENGTH, fmt, args);
size_t wtemp_len = BUFFER_LENGTH - 1;
Utf8toWStr(temp_buf, temp_len, wtemp_buf, wtemp_len);
CharToOemBuffW(&wtemp_buf[0], &temp_buf[0], wtemp_len + 1);
fprintf(file, "%s", temp_buf);
#else
vfprintf(file, fmt, args);
#endif
}
示例5: vutf8printf
void vutf8printf(FILE* out, const char *str, va_list* ap)
{
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
char temp_buf[32 * 1024];
wchar_t wtemp_buf[32 * 1024];
size_t temp_len = vsnprintf(temp_buf, 32 * 1024, str, *ap);
//vsnprintf returns -1 if the buffer is too small
if (temp_len == size_t(-1))
temp_len = 32*1024-1;
size_t wtemp_len = 32*1024-1;
Utf8toWStr(temp_buf, temp_len, wtemp_buf, wtemp_len);
CharToOemBuffW(&wtemp_buf[0], &temp_buf[0], uint32(wtemp_len + 1));
fprintf(out, "%s", temp_buf);
#else
vfprintf(out, str, *ap);
#endif
}
示例6: vutf8printf
void vutf8printf(FILE* out, const char* str, va_list* ap)
{
#if PLATFORM == PLATFORM_WINDOWS
std::string temp_buf;
temp_buf.resize(32 * 1024);
std::wstring wtemp_buf;
size_t temp_len = vsnprintf(&temp_buf[0], 32 * 1024, str, *ap);
temp_buf.resize(strlen(temp_buf.c_str())); // Resize to match the formatted string
if (!temp_buf.empty())
{
Utf8toWStr(temp_buf, wtemp_buf, 32 * 1024);
wtemp_buf.push_back('\0');
CharToOemBuffW(&wtemp_buf[0], &temp_buf[0], wtemp_buf.size());
}
fprintf(out, "%s", temp_buf.c_str());
#else
vfprintf(out, str, *ap);
#endif
}
示例7: CharToOemW
/***********************************************************************
* CharToOemW ([email protected])
*/
BOOL WINAPI CharToOemW( LPCWSTR s, LPSTR d )
{
return CharToOemBuffW( s, d, strlenW( s ) + 1 );
}