Question: IN UNIX : CREATE A C++ PROGRAM TTHAT CREATES DATABASE(FOLLOW INSTRUCTIONS BELOW) AND PROVIDE SCREENSHOTS OF WORKING PROGRAM:(good rating will be given) Create a sqlite3

IN UNIX : CREATE A C++ PROGRAM TTHAT CREATES DATABASE(FOLLOW INSTRUCTIONS BELOW) AND PROVIDE SCREENSHOTS OF WORKING PROGRAM:(good rating will be given)

Create a sqlite3 database (called mypasswd) and create a table (passwd) to load the passwd information from /etc/passwd file as shown below.

Task 1

{cslinux1:~/sqlite/passwd} sqlite3 mypasswd

SQLite version 3.14.1 2016-08-11 18:53:32

Enter ".help" for usage hints.

sqlite> create table pwtable (user, pass, uid, gid, gecos, home, shell);

sqlite> .separator :

sqlite> .import /etc/passwd pwtable

sqlite> select * from pwtable where user='root';

root:x:0:0:root:/root:/bin/bash

sqlite> select * from pwtable;

root:x:0:0:root:/root:/bin/bash

bin:x:1:1:bin:/bin:/sbin/nologin

daemon:x:2:2:daemon:/sbin:/sbin/nologin

sqlite> .exit

TASK 2

Your C++ program (a3p1task2.cpp) connect to the database and get all the entries in the pwtable (from Task#1) and output each record in a file ("a3p1task2.txt"). Each record should be formatted as shown below.

Record 1

user: root

uid: 0

gid: 0

gecos: root

home: /root

shell: /bin/bash

Record 2

For the first record: root:x:0:0:root:/root:/bin/bash

apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!