👤
Home Man
Search
Today's Posts
Register

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):
Quote:
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.
[...]
EFBIG
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.
[...]
ENOSPC
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 09:44 AM
Check the disk space then sftp znesotomayor Shell Programming and Scripting 2 06-07-2014 05:02 PM
Check disk space karthikeayan Shell Programming and Scripting 8 01-12-2013 01:21 AM
Looking to check disk space Jasminshakoor Homework & Coursework Questions 5 11-30-2012 02:43 PM
How to suppress the file name when we check for disk space arukuku Shell Programming and Scripting 7 01-25-2012 06:53 AM
Check and compare disk space and email it sgtjkj Shell Programming and Scripting 3 01-31-2011 09:13 AM
how to check disk space steve2216 Shell Programming and Scripting 15 08-25-2010 11:49 AM
Disk space check raghu.amilineni Solaris 6 03-18-2009 05:20 PM
Perl script to check free disk space susja Shell Programming and Scripting 1 06-28-2008 03:24 AM
Please help - disk space check script maddhadder71 Shell Programming and Scripting 0 05-08-2008 08:16 AM


All times are GMT -4. The time now is 06:03 PM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
×
UNIX.COM Login
Username:
Password:  
Show Password