Re: File size on glib




 Currently, I use stat. But have not tested on Windoze yet. ( Ia m just
thinking ahead for now. I will try as soon as I can.)

 As for disk space, you are right-- it is a whole new beast with quota and what
not. Not to add symlink.

 Let's see how it goes.

Thanks.

Harring.

 
--- "Peter \"Firefly\" Lund" <firefly diku dk> wrote:
On Mon, 4 Aug 2003, Harring Figueiredo wrote:

 Is there a portable/cross-platform function on glib to find out the size
of a
file/dir ?

Wouldn't lseek()/fseek() be good enough for that?  One is POSIX, the other
ANSI C89.

Granted, you would have to open the file first :)

stat() should handle that problem (POSIX).  Use recursion for directory
trees.

If Windows doesn't support those functions then it is even weirder than I
thought :(

 How can I also find out the space left on a disk from both windoze and
Un*x ?

That one is much harder.  One of the problems is what you mean by "space
left on disk" -- do you really mean space left or do you mean space left
for the current user?  There might be a quota system in use.  Or maybe
some percentage of a disk is set aside for the root user?  (I don't know
whether Windows has a similar concept - it might)

And what is a disk anyway, when you might have a single-rooted tree with
various mount points (perhaps even union mounts) and symlinks between
them?

And what if the disk (or subdirectory) is compressed?  Then it depends on
the actual data you are going to write later on.

And of course the whole thing is one big race condition anyway...


-Peter


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com



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