ls -l命令
系统效果:
列出文件属性,权限,用户等信息
简单实现代码:
#include<stdio.h>
#include<grp.h>
#include<time.h>
#include<pwd.h>
#include<dirent.h>
#include<sys/stat.h>
#include<stdlib.h>
#include<unistd.h>
#include<string.h>
struct stat sbuf;
struct stat sbuf_dst;
struct stat sbuf_reg;
void print_information(char* file);
void open_dir(char* dir)
{
DIR *pdir = opendir(dir);
struct dirent *pd = NULL;
struct stat sbuf_dst;
lstat(dir, &sbuf_dst);
if(pdir == NULL)
{
fprintf(stderr, "open dir error\n");
exit(1);
}
else
{
while((p