쿠분투 리눅스에서 C++을 사용하여 sys/stat.h의 stat를 사용하여 파일 소유자의 액세스 권한을 얻으려면 어떻게해야합니까?C++과 stat을 사용하여 소유자의 액세스 권한을 얻으십시오
struct stat results;
stat(filename, &results);
cout << "File type: ";
if (S_ISDIR(results.st_mode))
cout << "Directory";
else if (S_ISREG(results.st_mode))
cout << "File";
else if (S_ISLNK(results.st_mode))
cout << "Symbolic link";
else cout << "File type not recognised";
cout << endl;
은 내가 t_mode의 파일 모드 비트를 사용해야합니다 알고,하지만 난 방법을 모르는 :
현재,이 같은 파일의 종류를 얻을. See sys/stat.h