Public feed
#891521
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <iostream>
using namespace std;
int main()
{
struct dirent **namelist=NULL;
int n;
n=scandir("/tmp", &namelist, NULL, alphasort);
for(int i = 0; i < n; i++)
{
if(namelist[i]->d_type == DT_REG)
{
stat(namelist[i]->d_name, &s);
cout << namelist[i]->d_name << " " << s.st_size << endl;
}
}
}