Abanoub
Abanoub

Reputation: 3809

while accepting socket connection

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 *"

        }

how can i fix this prob :-s

Upvotes: 0

Views: 225

Answers (3)

Sogger
Sogger

Reputation: 16132

Cast buf to unsigned __int8 when you call Decrypt.

Decrypt((unsigned __int8*)buf);

Upvotes: 2

James
James

Reputation: 9278

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

Upvotes: 0

Sarfaraz Nawaz
Sarfaraz Nawaz

Reputation: 361442

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!

Upvotes: 3

Related Questions