this should give more info why it failed:Originally Posted by caduardo21
Code:int main( int argc, char *argv[] ) { if (remove("somedir") == -1) { perror("remove failed"); } return ( 0 ) ; }
this should give more info why it failed:Originally Posted by caduardo21
Code:int main( int argc, char *argv[] ) { if (remove("somedir") == -1) { perror("remove failed"); } return ( 0 ) ; }
I'm also trying to make my program delete a certain directory atm, I've tried rmdir and remove, but the problem is that my directory will never be empty upon deleting.
I can think of making a function to enter the directory, search for all files (and sub-dirs) and delete them one by one, but is there NO way this can be done easier? I.e. isnt there a function that deletes dirs regardless whether its empty or not?
BTW, perror; that's a great tip Laserve, thanks!