从 ANSI 转换为 Unicode

发布于 2024-08-20 22:24:32 字数 471 浏览 4 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

温柔少女心 2024-08-27 22:24:32

我的猜测是 ATL 不知道 u_char 因此它无法选择正确的转换。试试这个:

packet = A2T((char *)cpacket);

有关详细信息,请参阅

My guess is that ATL doesn't know u_char so it can't select the correct convertion. Try this:

packet = A2T((char *)cpacket);

For more information, see

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文