So I am writing a C program that is more of a shell and I have come to the point where I need to create a command to open a file in nano. I actually have this working pretty nicely and it is all working. Except that I am getting a Sh 1. Permission Denied when I open a file.
char filename[4080];
printf("Enter the file you wish to edit: ");
scanf("%s", filename);
char thething[4080];
sprintf(thething, "/usr/local/script/send_it.pl %s",
filename);
system(filename);`
When I run it this is what happens
pi@raspberrypi ~/JacoShell $ sudo ./shell
JacoShell: /home/pi/JacoShell $nano
Enter the file you wish to edit: /home/pi/JacoShell/test.txt
sh: 1: /home/pi/JacoShell/test.txt: Permission denied
JacoShell: /home/pi/JacoShell $
./shell is chmoded appropriately so I don't know what the problem is