Today's Posts

Post questions about C, C++, Java, SQL, and other programming languages here.

C++: how to check my directory disk space


Login to Reply

Thread Tools Search this Thread
# 1  
Old 04-20-2009
C++: how to check my directory disk space

I have a directory, and I write some files in to that. How to throw the error exception when my directory is full. i.e. there is no disk space
# 2  
Old 04-20-2009
Whether there's sufficient space left is normally not a concern of the directory but of the whole file system. There are things like quotas, which are normally supported by default by any distributor-made standard kernel but which have to be activated first.
So, I guess a call to statvfs() should do it.
# 3  
Old 04-20-2009
From the man-page of write(2):
Originally Posted by man(2)
[...]On success, the number of bytes written are returned (zero indicates nothing was written). On error, -1 is returned, and errno is set appropriately. If count is zero and the file descriptor refers to a regular file, 0 may be returned, or an error could be detected. For a special file, the results are not portable.
An attempt was made to write a file that exceeds the implementation-defined maximum file size or the process' file size limit, or to write at a position past the maximum allowed offset.
The device containing the file referred to by fd has no room for the data.
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Check free disk space in server anaigini45 Solaris 2 06-28-2017 10:44 AM
Check the disk space then sftp znesotomayor Shell Programming and Scripting 2 06-07-2014 06:02 PM
Check disk space karthikeayan Shell Programming and Scripting 8 01-12-2013 02:21 AM
Looking to check disk space Jasminshakoor Homework & Coursework Questions 5 11-30-2012 03:43 PM
How to suppress the file name when we check for disk space arukuku Shell Programming and Scripting 7 01-25-2012 07:53 AM
Check and compare disk space and email it sgtjkj Shell Programming and Scripting 3 01-31-2011 10:13 AM
how to check disk space steve2216 Shell Programming and Scripting 15 08-25-2010 12:49 PM
Disk space check raghu.amilineni Solaris 6 03-18-2009 06:20 PM
Perl script to check free disk space susja Shell Programming and Scripting 1 06-28-2008 04:24 AM
Please help - disk space check script maddhadder71 Shell Programming and Scripting 0 05-08-2008 09:16 AM

All times are GMT -4. The time now is 08:36 PM.

Unix & Linux Forums Content Copyright 1993-2018. All Rights Reserved.
Show Password