将int转换为wchar_t的正确方法是什么? [英] What is the proper way to convert an int to wchar_t?

查看:235
本文介绍了将int转换为wchar_t的正确方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说你有方法"

int Read(...)
{
    unsigned char Byte = 0;
    if(!ReadFile(.., &byte, 1,...))
        return -1;

    return Byte;
}


int ReadBlock(LPWSTR buffer, int cchBuffer ...)
{
    int c = 0;
    int cnt = 0;
    do
    {
        if( (c=Read(...)) != -1 )
            buffer[num++] = c; // Here.
    } while( num < ccBuffer );
    return cnt;
}

正确将该int传递给WCHAR的正确方法是什么?

What is the proper way to get that int correctly to WCHAR?

推荐答案

阅读

After reading When should static_cast, dynamic_cast and reinterpret_cast be used?, I realize it was my lack of knowledge about casting that triggered me to ask this question.

这篇关于将int转换为wchar_t的正确方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆