错误2664无法将Int转换为LPDWORD [英] Error 2664 CannotConvert Int To LPDWORD
本文介绍了错误2664无法将Int转换为LPDWORD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在这条线上出现错误...
I''m getting an error on this line...
if (WSAIoctl(sniffer, SIO_RCVALL, &j, sizeof(j), 0, 0, &in, 0, 0) == SOCKET_ERROR)
{
the &in is in red squiggles.
推荐答案
以下是使用WSAIoctl ^ ]
最好的问候
Espen Harlinn
Here is a good example using WSAIoctl Sniffing using Winsock[^]
Best regards
Espen Harlinn
这是因为DWORD
是unsigned long
,而不是int
.当直接将DWORD
设置为int
时,编译器将让您离开(通过执行隐式对偶运算),但是它不能对指针执行相同的操作,因此您要么必须将其显式转换为(错误,因为您不能保证它们的大小相同),或者即使实际将int复制到临时 DWORD
中,也要传递指向实际DWORD
的指针.
It''s because aDWORD
is anunsigned long
, not anint
. The compiler will let you off when directly setting aDWORD
to anint
(by doing an implicit convesion) but it can''t do the same for a pointer, so your either going to have to explicitly cast toLPDWORD
(Bad, since your''e not guaranteed that they will be the same size) Or pass a pointer to an actualDWORD
, even if you just copy your int into a temporaryDWORD
.
这篇关于错误2664无法将Int转换为LPDWORD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文