1 2 3 4 5
#pragma once #include <fcntl.h> #include <unistd.h> #include <sys/stat.h> static inline off_t ffilesize(int fd){ struct stat st; return fstat(fd,&st)?-1:st.st_size; }