The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 5 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Write a program in C++ to display the following information from Linux.
1. General information.
In this section you will assemble some basic facts about the system
a.  Machine name (hostname) # get this information from /proc/sys/kernel/hostname
b.  System date and time    # get this information from /proc/driver/rtc
c.  Kernel version # get this information from /proc/version
d.  Memory usage (used and free memory) # get this information from /proc/meminfo
2. Time information.
In this section you will print out how long the system has been up and how busy it has been.
a. Duration of uptime # get these information from /proc/uptime
b. Duration of idletime
The skeleton of the program
(1) read file A????1/proc/uptimeA????1 to obtain Totaltime and Idletime
(2) read file A????1/proc/sys/kernel/hostnameA????1 to obtain the hostname
(3) read file A????1/proc/versionA????1 to obtain the kernel version
(4) read file A????1/proc/meminfoA????1 to obtain the amount of used memory and free memory
(5) read file A????1/proc/driver/rtcA????1 to obtain time and date
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll