views:

227

answers:

1

Hi all,

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?

Thank you.

Regards, Rayne

+1  A: 

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

Aaron Digulla