#include <stdio.h>
#include <stdlib.h>
#inlcude <fcntl.h>

#ifdef __unix__
      #include <unistd.h>
      #include <sys/stat.h>
      #include <sys/types.h>
#elif __MSDOS__
      #include <io.h>
      #include <sys\stat.h>
#endif

long sizeall=0;

long groesse(char *dateiname)
{
 long size;
 int handle;
 handle=open(dateiname,O_RDONLY);
 return size=lseek(handle, 0L, SEEK_END);
}

int main(int argc, char *argv[])
{

 while(*++argv)
  {
   sizeall+=groesse(*argv);
   if(unlink(*argv) != -1)
      printf("%s wurde Erfolgreich gelöscht!\n",*argv);
   else
    {
      printf("Konnte %s nicht löschen!\n",*argv);
      sizeall-=grosse(*argv);
    }
  }
 printf("Es wurden insgesamt %.f KB gelöscht!\n",(float)sizeall/1024);
 return 0;
}
