Is it ok a function like this on a select, or will I have the same problem as I had with repetitive send functions?
I'm worried there about the 3 recv.. that's also why I was wondering how to do it all together like I wrote before..
Code:
void newfile(int *sock) {
char filepath[64];
int parts;
int totalparts;
int i;
i = *sock-1;
recv(*sock, filepath, sizeof(filepath), 0);
recv(*sock, parts, sizeof(parts), 0);
recv(*sock, totalparts, sizeof(totalparts), 0);
if((memfiles[i].file=fopen(filepath, "ab"))) {
memfiles[i].exists=1;
memfiles[i].parts=parts;
memfiles[i].totalparts=totalparts;
}
else {
printf("Error on creating new file");
}
}
And another question.. if I have a 64 char buffer, and I recv less than that, the fwrite function will write less than 64 char if the buffer doesn't have that ammount?