no save
Assistance
Achat
News

Forum | programmation
langage C probleme avec fonction read
Stupeflip, le jeu. 24 mai 2007 à 12:15:06
Heu readn(), c'est pas une fonction qui existe déjà ? Un truc pour lire plusieurs fois à la suite ?

Sinon essaye comme ça :
int read_sock (int sockhandle, unsigned char *buf, int taille)
{
int byte_lu = -1;
unsigned char *ptbuf =buf;
int length = taille;
int i = 0;

do {
byte_lu = read (sockhandle, ptbuf,length);
if (byte_lu > 0)
{
ptbuf = ptbuf+byte_lu;
length = length-byte_lu;
}
i++;
if(i > 10000)
return -1;
} while (length > 0);
return (length);
}Ca devrait marcher comme ça


PrécédentLaZo61
mai 07


REPONSES
Stupeflip
mai 07
LaZo61
mai 07
Stupeflip
mai 07
LaZo61
mai 07
Stupeflip
mai 07
Version Web
Réalisé par RedShift
no save