Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLEASE DO THESE 2 STEPS . Please also do NOT copy and paste other answers online. 1.) Write two programs (Interface & db) in C
PLEASE DO THESE 2 STEPS . Please also do NOT copy and paste other answers online.
1.) Write two programs (Interface & db) in C language PROVIDING the FULL CODE.
2.) Output that demonstrates that the code performs correctly. Create a data set of at least 12 elements and show that your results are correct. Note that the evaluation of the code may be performed with a larger data file. Also, consider abnormal cases as well.
Purpose: The objective of this project is to gain experience with UNIX (Linux) system calls and additional C language features. 2. Overview: You are to write two programs, interface and db. After initialization, interface will use the fork system call and an exec system call to start the execution of db. Interface will accept commands from the console and send them to db for execution. After executing the command, db will send the output to interface for display on the console. 3. Pipes: interface will need to create the pipes to be used for communication between itself and db prior to doing the fork. Use two pipes, one for sending commands to db and one for sending the response to interface. 4. Interface: In addition to tasks described elsewhere, interface must pass the pipe file descriptor values to db. Use the arguments on the exec command for this purpose. interface should also detect the final exit status of db and display an appropriate message. 5. DB : When db initializes, it must do two things before entering its loop accepting commands. First, it must initialize an array of structures (records) using the data in a local file called accountData. This file must contain data for at least twelve records. Second, it should display the contents of the array so it is easy to verify that the initialization occurred correctly. The records will keep track of a set of bank accounts. Each structure in the array is to consist of the following fields: id: this is the identifier of the account. It is to be a long integer. checkNumber: the check (or transaction) number (int). amount: The amount withdrawn from the account (float). date: The date of the transaction (char). You are to create and use a typedef for the record structure. 6. accountData: each line of this ASCII file is to contain the data for one record of the array of structures. Each line is expected to be in the form: id checkNumber date amount where a single space is used as a delimiter. 7. Makefile: Write a makefile to control the compilation of your programs. 8. Commands: Four commands must be processed: account,
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started