Question: I need this in Linux, Please help 1. How to use nd command to nd dirent.h in /usr? This header le denes an struct for
I need this in Linux, Please help
1. How to use nd command to nd dirent.h in /usr? This header le denes an struct for format of directory entries called dirent. 2. In your code, dene a pointer to the struct dirent. 3. dirent.h denes a struct called DIR. What is denition of DIR according to dirent.h? 4. dirent.h denes a function called opendir. What is denition of opendir according to dirent.h? 5. What is the description of opendir according to man? 6. Include sys/type.h as a header le in your code. 7. How to use nd command to nd sys/type.h in /usr? 8. What sys/type.h contains? 9. Dene a pointer with type directory stream (DIR). 10. The program needs to get an argument for the directory name. Check if the number of arguments (argc) is two, otherwise prints an error and exits the program. 1 11. Your program needs to open the directory given by argument argv[1]. Store it in your dened directory stream. Also check if the directory name is opened correctly, otherwise quit the program with an error message. 12. Your program should read all the entries in this directory, and then print all the le names and their sizes on the console. You may need to use stat function. 13. Your program should close the dened directory stream and check if the le is closed correct
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
