I am sending file from client to server using TCP. To mark the end of the file I like to send file size before the actual data. So I use stat system call to fin
If you are writing portable code, the answer is "you can't tell", the good news is that you don't need to. Your protocol should involve writing the size as (eg) "8 octets, big-endian format" (Ideally with a check that the actual size fits in 8 octets.)