I would like to execute this command in a C/C++ program: stat -c "%F %A %n" *filename goes here*
The filename is stored in the main
function's argv[1]
.
I tried it as execl("/bin/stat", "stat", "-c", "\"%F %A %n\"", "file", NULL);
How should the execl()
command look like to achieve the result?
I found my problem. The stat
command is located in /usr/bin
instead of /bin
.