System command is not working

Hi all, for some reason my system command is not working in my program. I use mac os. I wrote the main program "makefile" that passes control to the executable "statistics" that in turn process all of the data. This executable file (statistics) is located in the same directory as the main program that calls the function.
When I write system("statistics") I get the result: sh: statistics: command not found. Could you, please let me know what is wrong, Your time is very appreciated,

#include <iomanip>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <stdlib.h>
#include <ctime>
#include <cmath>

using namespace std;

int main()
int counter = 0;

ofstream rData; ("random.txt");


while(counter < 200)

{ //count the sum of 12 random numbers
int sum = 0;
int counter12 = 0;
while(counter12 < 12)

sum += (rand()%9);


//place the resulting sum into a file
rData << sum << ' ' ;

system("statistics"); // THAT IS THE COMMAND *******************************

return 0;

Well, I don't use the mac os, so I could be wrong. But possibly the path / folder / directory of the program "statistics" is not found by default, so you might need to change the OS settings to include it among the default path locations, or specify the full path to the program in your code.
On unix-like systems the current directory is often not in the search path (for security reasons) so you will have to put ./ in front of the executable name to run it. system("./statistics");
Thank you very much, now it works with the slash and a dot.!
Thank you ALL for taking your time to respond. Also, how do you look up this type of information, so next time I'll figure out it myself? manual, online? I went through hundreds of links in internet and couldn't find it. It would be great thing to learn how to learn. Sorry for tautology. Thank you.
Topic archived. No new replies allowed.