Question: A C++ problem about Group-ID processing. Please don't use the global language. User data (passwd.txt): The supplied file contains user information in the following colon
A C++ problem about Group-ID processing. Please don't use the global language.
User data (passwd.txt): The supplied file contains user information in the following colon (:) delimited format: loginID:passkey:uid:
Group information (groups.txt): The supplied file contains group information in the following colon (:) delimited format: groupID:passkey:gid:members
Here are the #includes in the reference solution for your convenient reference:
#include
#include
#include
#include
#include
#include
passed.txt:
root:xx:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin raodm:xyz:1000:1000:DJ Rao:/home/raodm:/bin/bash campbest:xxxxx:1001:1001:Scott Campbell:/home/campbest:/bin/bash lewisjp3:x:1002:1002:John Lewis:/home/lewisjp3:/bin/tcsh kiperjd:xooo:1003:1003:Jim Kiper:/home/kiperjd:/bin/ksh raychov:xp:1004:1004:Vaskar Raychoudhury:/home/raychov:/bin/ksh bachmaer:x:2000:2000:Eric Bachmann:/home/bachmaer:/bin/bash inclezd:x:1500:2000:Daniela Inclezan:/home/inclezd:/bin/bash davisk4:x:2001:2001:Karen Davis:/home/davisk4:/bin/bash femianjc:xya1234:2002:2002:John Femiani:/home/femianjc:/bin/bash crossv:x:2010:2010:Valerie Cross:/home/crossv:/bin/bash castroa:1111:2011:2011:Castro-Hernandez Alberto:/home/castroa:/bin/tcsh ahmede:x:2012:2012:Emdad Ahmed:/home/ahmede:/bin/bash
groups.txt:
root:xyzzz:0:0 bin:x:1: faculty:xx:2:1000,1001,1003,1004,2000,1500,2001,2002,2010,2011,2012 staff:x123:3:1002,1000 linux:xab:1000:2002,2012,1000,1001 admin:xabcdefg:5:1001,1002,0 theory:x:6:2001,1500,1004,2002 labs:yy:7:1000,1002,2001,2010,2012
Base case:
$ ./raodm_hw2 0 1 2 6 100 6 2
0 = root: root(0)
1 = bin:
2 = faculty: raodm(1000) campbest(1001) kiperjd(1003) raychov(1004) bachmaer(2000) inclezd(1500) davisk4(2001) femianjc(2002) crossv(2010) castroa(2011) ahmede(2012)
6 = theory: davisk4(2001) inclezd(1500) raychov(1004) femianjc(2002)
100 = Group not found.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
