rewrite the code to not require a fixed array.

properly parse the output of the command and store it in a C++ container (pick whichever one suits best).