So I am writing a C++ program that runs a command within the program. Whenever I do run the command though, it outputs a 0 at the end of whatever its supposed to output. Example:
The random int I was thinking of was 130
Where it is only supposed to output The random int I was thinking of was 13
but it still outputs the 0 at the end. Here is my code to run the command:
printf("Running file: %s\n", fileName);
if(!exists(fileName))
{
printf("That file does not exist.\n");
return;
}
char buffer [7+strlen(fileName)];
int n;
n = sprintf(buffer, "php -f %s", fileName);
cout << system(buffer) << endl;
I dont think it has anything to do with the php
command, because whenever I type into my terminal, php -f <filenamehere>
it comes out with the The random int I was thinking of was 13
output. I cannot think of anything else.