从 ANSI 转换为 Unicode
我正在使用 Visual Studio .NET 2003,并且尝试将纯 ANSI 字符编写的程序转换为独立于 Unicode/多字节字符的程序。
程序中有一个pcap_loop的回调函数,称为“got_packet”。它被定义为
void got_packet(u_char *user, const struct pcap_pkthdr *header, const u_char *cpacket)
{
USES_CONVERSION;
_TUCHAR *packet;
packet = A2T(cpacket);
...
}
但是,我收到错误消息
error C2440: 'type cast': cannot convert from 'const u_char *' to 'ATL::CA2WEX<>'
如何修复此问题?
I'm using Visual Studio .NET 2003, and I'm trying to convert a program written in purely ANSI characters to be independent of Unicode/Multi-byte characters.
The program has a callback function of pcap_loop, called "got_packet". It's defined as
void got_packet(u_char *user, const struct pcap_pkthdr *header, const u_char *cpacket)
{
USES_CONVERSION;
_TUCHAR *packet;
packet = A2T(cpacket);
...
}
However, I get the error message
error C2440: 'type cast': cannot convert from 'const u_char *' to 'ATL::CA2WEX<>'
How do fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的猜测是 ATL 不知道
u_char
因此它无法选择正确的转换。试试这个:有关详细信息,请参阅
My guess is that ATL doesn't know
u_char
so it can't select the correct convertion. Try this:For more information, see