I know I can get file size of FILE *
by fseek
, but what I have is just a INT fd.
How can I get file size in this case?
You can use lseek
with SEEK_END
as the origin, as it returns the new offset in the file, eg.
off_t fsize;
fsize = lseek(fd, 0, SEEK_END);