Q:

C++ bruteforce program very slow

I got a blackbox program "secret.exe" that accepts a number as an argument. It only accepts one number that I don't know. I want to do a brute force attack to get that number. 
The C++-program below does that but is pretty slow (13 numbers per second). CPU and memory are nearly not consumed by this program. 
What is the bottleneck? Is the popen-function to slow?
#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
       char psBuffer[128];
       FILE *chkdsk;
       bool nomatch = true;
       int i = 0;
       char cmd[100];
       while(nomatch){
           sprintf (cmd, "secret.exe %d", i++);
           if( (chkdsk = popen( cmd, "rt" )) == NULL )
              cout << "error";
           while( !feof( chkdsk ) ) {
              if( fgets( psBuffer, 128, chkdsk ) != NULL && strcmp(psBuffer, "wrong")){
                  cout << "password: " << --i << endl;
                  cout << "secret info : " << psBuffer << endl;
                  nomatch = false;
              }
           }
           pclose( chkdsk );
       }
      return 0;
}

A:

You'll have to benchmark/profile to find out, but it's entirely possible that secret.exe just wastes time.

