Re: Finding size of a file from a program

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



abrar momin wrote:


On 1/19/07, Pharaoh . <pharaoh137@xxxxxxxxx> wrote:
Hi
How to find size of a file from a userspace program without using shell commmands with system() etc?
I want to allocate a buffer and read the entire contents of a file, I know this is not good for large files, but I am just
experimenting with small file currently so this is good enough. Is there any system call available for this?



elegent solution
use mmap
how will you use mmap to get the size of the file?

as for doing it the not so right way
u can always move to the EOF to get the size of the file


--
abrarahmed
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux