c++posixqnxqnx-neutrinoposix-api

How to execute "top" only 1 time in QNX (c++ programming)


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 ?


Solution

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