The following code can be used as a starting point You will write a C++ program
ID: 3673143 • Letter: T
Question
The following code can be used as a starting point
You will write a C++ program for the following tasks Every System Administrator sooner or later has to write a program to run a command (e.g., traceroute) and to extract some data or information from the output of the command. Your C++ program should run the command (traceroute) and produce the output in a file, to be read and processed to extract some of the information from the output of the command You name your program mytrace.cpp for source and mytrace for executable Partl Your program is to run a command (traceroute) via system call, to produce its output to a file See the sample output of traceroute command given below See the sample program (trace0.cpp) given below, and you may use some of this sample code to your program. Part2 Your program is to read the output file (Part1) line by line, to extract the following 5 data items from each line IP addresses, DNS names, 3 time-measure of packets (for min, max, average time) and print these information to the console with headings (formatted and aligned) IP address DNS name Time: (min), ...(max), (average)Explanation / Answer
$ ifconfig -a lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 options=3<RXCSUM,TXCSUM> inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280 stf0: flags=0<> mtu 1280 en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 ether 98:fe:94:46:f4:44 inet6 fe80::9afe:94ff:fe46:f444%en0 prefixlen 64 scopeid 0x4 inet 192.168.1.2 netmask 0xffffff00 broadcast 192.168.1.255 inet6 2001:470:1f07:2c0:9afe:94ff:fe46:f444 prefixlen 64 autoconf inet6 2001:470:1f07:2c0:1834:f67:2271:a5eb prefixlen 64 autoconf temporary media: autoselect status: active p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304 ether 0a:fe:94:46:f4:44 media: autoselect status: inactive $ ifconfig -a | ifcfg-data -i fe80::1 127.0.0.1 ::1 fe80::9afe:94ff:fe46:f444 192.168.1.2 2001:470:1f07:2c0:9afe:94ff:fe46:f444 2001:470:1f07:2c0:1834:f67:2271:a5eb $ ifconfig -a | ifcfg-data -m 98:fe:94:46:f4:44 0a:fe:94:46:f4:44 $ ifconfig -a | ifcfg-data -n 0xff000000 0xffffff00 $
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.