home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS - Coast to Coast
/
simteldosarchivecoasttocoast.iso
/
pcmag
/
vol8n02.zip
/
USED.C
< prev
Wrap
C/C++ Source or Header
|
1988-07-13
|
610b
|
31 lines
/* used.c
calculates total bytes occupied by filespec passed on command line
If no parameter is passed, defaults to '*.*'
*/
#include <dos.h>
#include <stdio.h>
main(argc,argv)
int argc;
char *argv[];
{
struct find_t SpaceUsedBy;
long total = 0L;
if (argc < 2)
{
printf("\nUsage: used <filespec>\n");
exit(1);
}
if(!_dos_findfirst(argv[1],_A_NORMAL,&SpaceUsedBy))
total = SpaceUsedBy.size;
while(!_dos_findnext(&SpaceUsedBy))
total += SpaceUsedBy.size;
printf("\n%s uses %ld bytes\n",argv[1],total);
}