hi, i got a question. For:
execl("/usr/bin/cat", "cat", "/crap data", NULL);
fprintf(stderr, " error");
shldnt the fprintf be executed if execl of cat fail??
hi, i got a question. For:
execl("/usr/bin/cat", "cat", "/crap data", NULL);
fprintf(stderr, " error");
shldnt the fprintf be executed if execl of cat fail??
No it should not. You have it set to print after its done executing. Please tell me you are a c student at a public high school.
Yes, it will print if the exec of cat fails.
But cat attempting to open a garbage file does NOT constitute a failure to run cat itself.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
ic thanks salem