Public feed #891521

Something

public text v1 · immutable
Raw Edit
·published 2008-02-04 18:19 UTC
rendered paste body
#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;
		}
	}
}