Create a struct data structure for each file contained

Assignment Help Database Management System
Reference no: EM13325465

Your assignment is organised into two parts:

Stage 1

In order to guide you through the design and implementation of the required application, perform the following steps including:

1. Write a password protected console-based application, which enables you to create user accounts and specify the name of the file or directory to be shared with other users.

2. Write a simple console-based (ie text-based) menu system to enable the users to select from a set of functions provided by your system including:

a. Create a new user

b. Create a database file, where the implementation requirements for this are defined in bullet point 3 (below).

c. Exit the program

3. Write a function that enables you to create a struct data structure for each file contained in your shared directory. Where each file signature record is stored in a struct of the following form:

struct FileSig {
char name[256]; // File or directory name int mode; // protection and file type int user_id; // User ID of owner
int group_id; // Group ID of owner int size; // file size in bytes
char time_last_mod[50]; // modify time as a string
};

4. Add to your main() function relevant statement(s) to create an instance of the FileSig struct called fileSig. Also use in your main function relevant code to initialise your fileSig struct for two filenames of your choice. Hint: when initialising the fileSig struct ask the user to enter file information/detail rather than by interfacing the Filesystem.


Please note:

For the Stage 1 submission you are not required to do any file I/O for instance to store your file details and/or directory listing. But this will come in Stage 2.

Stage 2:

In order to guide you through the implementation of the new functionality, please follow the following steps including:

Part 1

Extend your program by writing a new C function, which will store and save the logging information into a text file called config.txt. Thus, you will need to amend your code to validate the username and password details entered by a user against those stored on file. Consequently, your system should allow access if users have a valid username and password.

Part 2

Extend your program by writing a new C function to take as input a file containing a list of file names (fully qualified path names; one per line) and produce a database file consisting of file signature records. It is upto you to decide how to generate this file - either manually using the ls command, or by other means. In this file each file signature record is stored in a struct of the following form:

typedef struct {
char name[256]; /*File or directory name*/ u_short mode; /*protection and file type*/ short user_id; /*User ID of owner*/
short group_id; /*Group ID of owner*/
off_t size; /*file size in bytes*/
char time_last_mod[50]; /*modify time as a string*/
} fileSig;
Hint: All needed information to perform this task can be found in the inode. To modify time, use function ctime to convert to a human readable string. The function prototype can be as follows:

void mkSigData(<fileList>, <database>);

where <fileList> is the name of the file that contains the list of files to get information about. The <database> is the name of the file (your program will create) that will contain the selected inode information for all the files. This database file will contain a series of structs of type fileSig (outlined above), one for each file listed in the fileList.

There must be no other output apart from standard error output associated with system call and function call errors.

Part 3

Extend your program by writing a new C function that will take as input the database file generated in Part 2. The function should simply print to screen the details of each fileSig stored.

Reference no: EM13325465

Questions Cloud

Evaluate the difference in the chemical potential : Calculate the difference in the chemical potential of sucrose at 0.01 M and at 0.0001 M concentrations.
Find the total electric potential at the origin : Two point charges are on the y axis. A 5.20-µC charge is located at y = 1.25 cm, and a -2-µC charge is located at y = ?1.80 cm. Find the total electric potential at the origin
Explain the difference between efficacy and effectiveness : Explain the difference between efficacy and effectiveness from a health care perspective. How does a hospital administrator create a balance between the two?
To analyse a given business case : To analyze a given business case and propose a knowledge management system design for the given business problem.
Create a struct data structure for each file contained : Write a password protected console-based application, which enables you to create user accounts and specify the name of the file or directory to be shared with other users.
What are the nominal and effective interest rates : Tony Soprano borrowed $200,000 from his "Shylock" friend Herb to cover his gambling losses. The "vig" is 1.5 points (%) per week. What are the nominal and effective interest rates?
What would be the speed of the electron in this model : An early model of the hydrogen atom viewed it as an electron orbiting a proton in a circular path with a radius of 5.29×10?11m. What would be the speed of the electron in this model
They are offered financing which requires : Jerry and his wife decide this is a good time to buy a house.They have a down payment and need to borrow $250,000.They are offered financing which requires a 2% loan origination fee and monthly payments of $1,500 per month for 30 years.what is their ..
How much consumer surplus does he receive : On Thursday nights, a local restaurant has a pasta special. Ari likes the restaurant’s pasta. His willingness to pay for each serving is shown below:

Reviews

Write a Review

Database Management System Questions & Answers

  What is the goal of computer forensics

From your knowledge and experience how are computer forensic investigators, in today's world of complex technology, are able to retrieve and analyze data that can be used in computer forensic investigations.

  Illustrate concurrency control method by two phase locking

For each table argue whether or not interference with another transaction is possible. Illustrate concurrency control method using two phase locking.

  To analyse and comprehend a provided er diagram

Display the item id and the difference between the default price and cost (ITECH5006 - together with a percentage markup) of all products.

  Create relational schema of database in 3nf

A Relational schema of your database in 3NF, clearly indicating attributes, the data type of each attribute, primary and foreign keys, candidate keys, and which attributes are nullable, giving reasons. List any assumptions you need to make.

  Pros and cons in agile and waterfall project management

Evaluate the pros and cons in agile and Waterfall project management in terms of planning and the execution of projects and collaboration among project team members.

  Generate a database diagram

For each of these statements, include a screenshot of the SQL. Make sure to include the statement execution, including the resulting data. Display all columns and all rows from the Employees table.

  Review of object oriented software development methodologies

Analyze how the verify method can be used to plan out system effectively and ensure that the number of transactions do not produce record-level locking while the database is in operation.

  Integrity constraint prevent-data inserted in table

Integrity constraint prevent from happening when data is inserted in table which contains this constraint? Let INSERT, UPDATE, and DELETE actions on both child and the parent.

  Various kinds of keys to form or define relationships

Relational database is based on fact that data in one table can be tied, or related to data in another table. To do this, database utilizes various types of keys to form or define these relationships.

  Modify oracle table data using the correct sql statements

Explain how you could delete the IT department without deleting all the employees who work for that department.

  Knowledge and data warehousing

Design a dimensional model for analysing Purchases for Adventure Works Cycles and implement it as cubes using SQL Server Analysis Services. The AdventureWorks OLTP sample database is the data source for you BI analysis.

  Electronic spreadsheets in data modeling

Explain in detail with supporting illustrations the six stages of the problem solving process and explain when the choice for using electronic spreadsheets is the preferred tool of choice.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd