I am trying to do a protocol in c. It has to know the file size to pass it into a protocol which goes between client and server. This is the way I did it.
B32U file_size(FILE * file) {
assert(file != NULL);
B32U old = ftell(file);
fseek(file, 0, SEEK_END);
B32U size = ftell(file);
fseek(file,old,SEEK_SET);
return (size);
}
Does anybody know a better way in order to do that? Since know thans