getting 'df' info from inside a program?
Conor P. Cahill
cpcahil at virtech.uucp
Thu Jun 28 23:16:32 AEST 1990
In article <3394 at sactoh0.UUCP> jak at sactoh0.UUCP (Jay A. Konigsberg) writes:
>In article <797 at massey.ac.nz> GEustace at massey.ac.nz (Glen Eustace) writes:
>>We are trying to write some code that will check whether a file will
>>fit on a given file system prior to copying it. It would be great if
>>the information given in a 'df' were available with some system call.
>>Does anyone know whether there is one and if so how one uses it.
>>
>This looks like a job for the stat() system call. (Sys V)
First off, you answer the wrong question. The poster wanted to know how much
space was left on the file system, not how big a file was. (Read before you
post)
>buf = (struct stat *)malloc(sizeof(struct stat)); /* error check removed */
>
>if ( stat("filename", buf) == -1 )
Using the return from a malloc before you check to see if it is null?
tsk, tsk, tsk.
> {
> fprintf("stat: error=%d\n", errno);
Calling fprintf without a file pointer????
tsk, tsk, tsk.
--
Conor P. Cahill (703)430-9247 Virtual Technologies, Inc.,
uunet!virtech!cpcahil 46030 Manekin Plaza, Suite 160
Sterling, VA 22170
More information about the Comp.sys.pyramid
mailing list