Solved

Determine disk free space

Posted on 2002-07-09
5
286 Views
Last Modified: 2008-02-26
I need to determine disk free space.

I want to write cross platform function (Windows / HP).
For Windows i use GetDiskFreeSpaceEx(...) function.
I need same function for HP.
Any suggestions ....
0
Comment
Question by:Rostik
5 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 7140488
What do you mean by "HP"?  If that's Hewlett-Packard, you need to specify the machine/operating system.  HP makes MANY different computer systems and has several different operating systems including Windows on their systems.
0
 

Author Comment

by:Rostik
ID: 7140499

I have HP-UX 11.00
0
 
LVL 86

Accepted Solution

by:
jkr earned 50 total points
ID: 7140566
Use 'statfs()':

NAME
       statfs, fstatfs - get file system statistics

SYNOPSIS
       #include <sys/vfs.h>

       int statfs(const char *path, struct statfs *buf);
       int fstatfs(int fd, struct statfs *buf);

DESCRIPTION
       statfs  returns  information  about a mounted file system.
       path is the path name  of  any  file  within  the  mounted
       filesystem.   buf  is  a  pointer  to  a  statfs structure
       defined as follows:

              struct statfs {
                 long    f_type;     /* type of filesystem (see below) */
                 long    f_bsize;    /* optimal transfer block size */
                 long    f_blocks;   /* total data blocks in file system */
                 long    f_bfree;    /* free blocks in fs */
                 long    f_bavail;   /* free blocks avail to non-superuser */
                 long    f_files;    /* total file nodes in file system */
                 long    f_ffree;    /* free file nodes in fs */
                 fsid_t  f_fsid;     /* file system id */
                 long    f_namelen;  /* maximum length of filenames */
                 long    f_spare[6]; /* spare for later */
              };
0
 
LVL 11

Expert Comment

by:griessh
ID: 7375934
Dear Rostik

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "jkr"

comment(s) as an answer.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7419764
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now