0

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; } 
2
  • but how do I do that, I went to the properties of the executable file of the project and that is the path that shows Commented Aug 18, 2015 at 2:02
  • First of all, open console an type: cd /home/Int_Outputs/bin and then sudo chmod u+r Debug. If that changes nothing, explain what exactly does not work. Commented Aug 18, 2015 at 2:06

1 Answer 1

2

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"

Sign up to request clarification or add additional context in comments.

3 Comments

well, I am able to run it from the terminal by doing "./Int_Outputs"
@user5231043: Really? The question implies that Int_Outputs is a directory, and the application is called Debug.
Ok, never mind I just saw my mistake, I am missing "Int_Outputs" after "Debug" since that is the executable file and Debug is just the folder.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.