Reputation: 79
I am trying to run an executable file within a c++ code. It compiles and run, but it displays a message "permission denied". This same code works on windows, I just use the appropriate file path.
Here is the code I am using
FILE *fp = popen("/home/Int_Outputs/bin/Debug","r");
if (fp == NULL){
std::cout <<"Popen is null" << std::endl;
}
char buff[50];
fgets(buff,sizeof(buff),fp);
std::cout << buff;
}
return 0;
}
Upvotes: 0
Views: 1211
Reputation: 411
What are the POSIX permissions for that file? To find out, open a terminal shell and do:
$ ls -l /home/Int_Outputs/bin/Debug
You have to make sure that the UID/GID that your application runs as has permission to read the file "/home/Int_Outputs/bin/Debug"
Upvotes: 2