日期:2014-05-16 浏览次数:20990 次
#include <iostream>
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
using namespace std;
int main()
{
DIR *dp;
struct dirnet *dirp;
if((dp = opendir("/work"))== NULL)
{
cout << "can't open /work" << endl;
}
while((dirp = readdir(dp)) != NULL)
{
printf("%s\n", dirp->d_name);
}
cout << "Hello World!" << endl;
return 0;
}