How to execute “top” only 1 time in QNX (c++ programming) Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of How to execute “top” only 1 time in QNX (c++ programming) without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I am trying to write simple application for QNX. I installed qnx momentics ide, connected it to QNX virtual machine, and trying to execute “top” command

#include <cstdlib>
#include <iostream>
#include <process.h>
#include <string>
using namespace std;

int main(int argc, char *argv[]) {
    system("top");
    return EXIT_SUCCESS;
}

And i am getting and getting result until i kill “top” process manually in QNX virtual machine. But i need only 1 time. Any ideas ?

Answer

This page suggests you should change system("top") to system("top -i 1").

We are here to answer your question about How to execute “top” only 1 time in QNX (c++ programming) - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji