0

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 ?

  • 1
    `top -n 1` would achieve that on Linux. Dunno if the QNX version accepts the same inputs, but `man top` (or whatever QNX uses instead of `man`) would tell you – benjymous Nov 14 '13 at 14:36

2 Answers2

0

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

evadeflow
  • 4,704
  • 38
  • 51
0
top -i 1

is the correct syntax to get only one iteration. -n # is for node count.

gcal
  • 21
  • 1