开发者

while accepting socket connection

unsigned __int8 Decrypt(unsi开发者_运维百科gned __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 *"

        }

how can i fix this prob :-s


Why don't you use this signature:

unsigned char Decrypt(char *data);

instead of

unsigned __int8 Decrypt(unsigned __int8 data[]);

If you do so, you can easily pass buf to it, since even though buf is declared as char buf[4095], it will become pointer type automatically when you pass it to Decrypt. No need to cast!


Cast buf to unsigned __int8 when you call Decrypt.

Decrypt((unsigned __int8*)buf);


cast it to the correct type.....................................

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜