hi,
i have a char* filename and want to determine if the file is an executable file.
first, which is the best way to find that out? i have chosen to use the "file" command. i want to make file post its output to a pipe "pipefile" . my process then reads the pipe contents and checks for the string "executable"
since writing to a pipe blocks i need to fork a child for that.
please see if the following is somewhat sound:
now i really dont know how to call execlp correctly so that file will write its output to the pipe.Code:... int i = fork(); if (i == 0) execlp("file",...) } else { read("pipefile",buffer); waitpid(i); process_buffer(); }
hope someone can help me?



LinkBack URL
About LinkBacks


