2011-02-09 107 views
0
unsigned __int8 Decrypt(unsigned __int8 data[]); 

for(;;) 
    { 
     if((sConnect=accept(sListen,(SOCKADDR*)&addr,&addrlen)) != INVALID_SOCKET) 
     { 
      Print("Socket Connected Successfully!"); 
      char buf[4095]; 
      recv(sListen,buf,sizeof(buf),0); 
      Decrypt(buf); // Error:IntelliSense: argument of type "char *" is incompatible with parameter of type "unsigned char *" 

     } 

如何解决这个概率:-s在接受套接字连接

+1

为什么不声明buf为'unsigned __int8 [4095]`类型? – James 2011-02-09 17:37:28

回答

2

当您调用Decrypt时,将buf转换为未签名的__int8。

Decrypt((unsigned __int8*)buf); 
3

你为什么不使用这个签名:的

unsigned char Decrypt(char *data); 

代替

unsigned __int8 Decrypt(unsigned __int8 data[]); 

如果您这样做,你可以很容易地通过buf它,因为即使buf被宣布为char buf[4095],当你将它传递给Decrypt时,它将自动成为指针类型。不需要投!

0

将其转换为正确类型.....................................