Reputation: 1
I want to implement some pipes and reproduce a ls |sort |grep command so i started with the ls part and for testreasons i wanted to print out the conclusion from bin/ls part but i cant access upper directories
execl("/bin/ls", "ls", "-lR", directy, NULL);
I want to access for example ~/Desktop which works fine from the shell but not from the program itself. I tried out multiple different versions and can access a subdirectory of hte current folder
Upvotes: 0
Views: 316
Reputation: 11377
As pointed out by Ian Abbott, expansion of ~ is a feature of the shell program. Instead you can use the getenv function and read the HOME environment variable so you can construct the string $HOME/Desktop.
Upvotes: 3