Reputation: 9419
I'm experimenting with pipes in C. I want to connect the Standard Output of file1
:
int main() {
printf("6");
}
...to the Standard Input of file2
:
int main() {
int number;
scanf("%d", &number);
printf("The number is %d.", number);
}
The output should be: The number is 6.
In Xcode, file1
is appended to the executable (the target). I open the Terminal app, change the directory to the Debug folder (which contains the executable file) and issue this line:
.\TestDrive | /usr/someone/somewhere/file2.c
TestDrive
is the name of the executable file (that contains file1
). Since file2
is not contained in the Debug folder, I have to specify the full path of it. If you wish, you can download the project here.
In the console, I get Permission denied
. What am I doing wrong?
Upvotes: 1
Views: 329
Reputation: 49803
If you are piping into /usr/someone/somewhere/file2.c
, it is expected that that file is executable; .c
files generally are not, but the file that got generated by compiling it probably is.
Upvotes: 2
Reputation: 1441
You should make your TestDrive file executable, from the command line via chmod.
Upvotes: -1