are you suppose to only use one DIR declarations, for example
DIR *dir_ptr;
because I'm declaring mine like so:
DIR *dir_ptr_src, *dir_ptr_dest;
and using it like so:
if( ( dir_ptr_src = opendir ( av[1] ) ) != NULL && ( dir_ptr_dest = opendir( av[2] ) ) != NULL ) /* check if both arguments are directories */
That all looks fine....are you having other problems then ?
I see no reason that should present an issue.... "DIR *" is for directories what "FILE *" is for files.
However, if all you're trying to do is see if the file is a directory then you can (and arguably should) use the "fstat" function and the "S_ISDIR" macro as this is a more direct method to obtain that information and, as such, has less overhead.
Thank you!!! thats what I was looking for, I wanted to validate if the file is a directory.