"q6 & 7 ok"
This commit is contained in:
parent
b46206336c
commit
16a0a5ac18
@ -4,7 +4,7 @@
|
|||||||
* @ Copyright: Creative Common 4.0 (CC BY 4.0)
|
* @ Copyright: Creative Common 4.0 (CC BY 4.0)
|
||||||
* @ Create Time: 04-09-2020 11:43:11
|
* @ Create Time: 04-09-2020 11:43:11
|
||||||
* @ Modified by: JunkJumper
|
* @ Modified by: JunkJumper
|
||||||
* @ Modified time: 10-09-2020 11:46:13
|
* @ Modified time: 10-09-2020 11:51:26
|
||||||
* @ Description: code c produisant le même résultat qu'un ls.
|
* @ Description: code c produisant le même résultat qu'un ls.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ int main(int argc, char *argv[])
|
|||||||
dir = opendir(argv[1]);
|
dir = opendir(argv[1]);
|
||||||
chdir(argv[1]);
|
chdir(argv[1]);
|
||||||
entry = readdir(dir);
|
entry = readdir(dir);
|
||||||
printf("%-10s %-5s %-30s %-30s\n", "Inode", "Type", "Nom de Fichier", "Stats inode");
|
printf("%-10s %-5s %-30s %-30s\n", "Inode", "Type", "Nom de Fichier", "Nombre de liens durs");
|
||||||
while(entry != NULL) {
|
while(entry != NULL) {
|
||||||
lesAtt = stat(entry->d_name, &attribut);
|
lesAtt = stat(entry->d_name, &attribut);
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ int main(int argc, char *argv[])
|
|||||||
perror("Échec stat");
|
perror("Échec stat");
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
printf("%-10d %-5d %-30s %-30d\n", (int)entry->d_ino, entry->d_type, entry->d_name, attribut.st_ino);
|
printf("%-10d %-5d %-30s %-30d\n", (int)entry->d_ino, entry->d_type, entry->d_name, attribut.st_nlink);
|
||||||
entry = readdir(dir);
|
entry = readdir(dir);
|
||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user