Write a C or C++ program to run on a Unix platform. This program will take three arguments. The first argument will be the pathname of a directory on the system. The second argument will be a character string. second argument is a substring of a file name. you are searching for files(that match the substring of the name of the file given in the 2nd argument) in the directory, including subdirectories within the root directory. For example, if the 2nd argument is “sys”, then one of your outputs can be a “systems” file, if you have that file in your directory. you are going to print the maximum N files name(that matches the substring). you also need to print a few information associated with the file, such as file size, using stat system call. and you need to redirect your output to a text file.The third argument is the maximum number of output lines, N. Your program should display at most N entries in the directory tree in a text file. You need to implement three system calls: Open, Read, and Stat Details of the system calls are given below. You can also use man command pages to learn more about these system calls. 1. Open system call: DIR *opendir (const char *dirname) Opendir system call opens a directory and returns a pointer to a struct DIR. DIR represents a directory stream, which is an ordered sequence of all directory entries in a particular directory. 2. Read system call: struct dirent *readdir (DIR *dirp) Once the directory has been opened, you can read the directory with readdir system call. Each time you call readdir system call, it returns another entry in the directory. 3. Stat system call: int stat (const char *path, struct stat *sb) Once you have the name of an entry, you can use the stat system call to get more information about it. stat function takes two arguments, the first is a path name and second is a pointer to struct stat, which contains information about the file.
Why Choose Us
- 100% non-plagiarized Papers
- 24/7 /365 Service Available
- Affordable Prices
- Any Paper, Urgency, and Subject
- Will complete your papers in 6 hours
- On-time Delivery
- Money-back and Privacy guarantees
- Unlimited Amendments upon request
- Satisfaction guarantee
How it Works
- Click on the “Place Order” tab at the top menu or “Order Now” icon at the bottom and a new page will appear with an order form to be filled.
- Fill in your paper’s requirements in the "PAPER DETAILS" section.
- Fill in your paper’s academic level, deadline, and the required number of pages from the drop-down menus.
- Click “CREATE ACCOUNT & SIGN IN” to enter your registration details and get an account with us for record-keeping and then, click on “PROCEED TO CHECKOUT” at the bottom of the page.
- From there, the payment sections will show, follow the guided payment process and your order will be available for our writing team to work on it.