Question: C++/Linux Help Hello I need help writing a program in C++ that uses linux. I am suppose to get output information on linux by writing

C++/Linux Help

Hello I need help writing a program in C++ that uses linux. I am suppose to get output information on linux by writing a program in c++.

Example:

I am trying to get the hostname of my device and output it.

I am suppose to use cat /proc/sys/kernel/hostname

how do I write that to a C++ program? I assumed I use cout<< "Hostname: " << cat /proc/sys/kernel/hostnam<

but that is not right, how would I do this?

I'm also trying to fin uptime, memory and time. I know how to using the proc command.

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!