Write a C
1. Delete a file or a directory
2. Output the Process ID of the running program
3. List all the files and directories
4. Exit
Please note:
· If users select 1, the program should prompt for the file or directory name to be deleted.
· If users select 2, the program should display the Process ID of the running program.
· If users select 3, the program should create a child process (using fork and execl or execv) to execute the "ls -l" command.
· If users select 4, the program should exit.
· If users select anything else, the programs should display the menu again.
to generate a solution
a solution
- Using c++ computer languagearrow_forwardin c# i need to Write the program named DirectoryInformation that allows a user to continually enter directory names until the user types end. If the directory name exists, display a list of the files in it; otherwise, display the following message, Directory foo does not exist, to indicate the directory does not exist (foo would be the name of the directory to be checked) . Create as many test directories and files as necessary to test your program. An example of the program is shown below: Enter a directory >> lorem lorem contains the following files lorem/ipsum.txt Enter another directory or type end to quit >> foo Directory foo does not existarrow_forwardA local variable is a variable defined in another file included in the program specifically inside the main function inside any function outside any functionarrow_forward
- Select the statements that describe a multimodule program. each ASM file (module) is assembled into a separate OBJ file is a program whose source code has been divided up into separate ASM files are dynamically linked at runtimearrow_forwardWrite a C program that, given a text file, constructs Huffman code based on the character frequencies of the file and then encodes the file accordingly. The executable must accept the following command line options:• -i filename for the input file • -o filename for the output filearrow_forwardPart 1 Opening, Compiling and Running Your First Program Exercise 1: Logon to your system based on your professor’s instructions. Exercise 2: Bring in the firstprog.cpp program from the Lab 1 folder. Exercise 3: Compile the program. Exercise 4: Run the program and write what is printed on the screen. The code of firstprog.cpp is as follows: // This is the first program that just writes out a simple message// Place your name here#include <iostream> // needed to perform C++ I/Ousing namespace std;int main (){cout << "Now is the time for all good men" << endl;cout << "To come to the aid of their party" << endl;return 0;}arrow_forward
- TRUE OR FALSE // C PROGRAMMING LANGUAGE When a file opened for writing already exist its contents would be over writtenarrow_forwardlanguage is C++ Use Lastname First name, JonnyEnglish Instructions 1. Using Visual Studio, or Xcode, create a new empty project in your working drive. Name the Project: 05LastFirst (NOTE: where LastFirst is your actual Lastname and Firstname. For Example, if your name is Mary Smith then your empty project folder will be named 02SmithMary) 2. You will be updating your 05CH3 program. You will develop an Algorithm and then update your C++ Program for the problem described below: Have the user input test grades UNTIL user enters a negative number. The program will: list the number of grades entered, list the number of passing grades (>= 60) total all the grades, and then display the average of the grades. For example: Enter score 1: 88.8 Enter score 2: 50 Enter score 3: 100 Enter score 4: 100 Enter score 5: -1 Total number of grades: 4 Total number of passing grades: 3 Total: 338.8 Average: 84.7 (NOTE: Follow the steps below in creating your Algorithm and C++ Program.…arrow_forwardOpen a file called readme.txt in the child process, read the contents and pass to the parent process. Parent process will write to readme.txt, “Parent is writing:” and write the contents it received from the child to the readme.txt file. (Hint: Use Pipe) // c programing languagearrow_forward
- write a program that operates like a cashier terminal in a grocery store it begins by prompting for the number of different items being purchased and then starts a loop in the loop the program should prompt for the item description price and quantity of each item being purchased these three values should be passed as arguments to a custom function that is to find in a separate module file the imported function should print the subtotal for the item and return it to main the total should be printed in Main after the loop endsarrow_forwardPython Soulution to 1arrow_forwardUse C++ Write a program that prints a menu of choices: L -> Find the lowest value in a file H -> Find the highest value in a file A -> Find the average value in a file Q -> Quit Choose: The program does input validation and asks the user to reenter as long as the user’s choice does not correspond to an item on the menu. Invalid choice. Re-enter: If the user selects any valid choice other than Quit, the program prompts the user to enter the file name, Enter input file name: then reads the content of the file and prints the value requested (highest value, lowest value or average value). Highest value is 0 Lowest value is 0 Average value is 0 If the file cannot be opened or is empty, the program should display the message: File empty or could not open file Then the program displays the menu again. If the user selects Quit, the program prints “Exiting” and terminates. Additional requirements – Make sure you meet all the requirements You are not allowed to use arrays You are…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education