Hi all,
I want to search the offline transaction file names in the defined directory, I wrote the following code and did testing but the result failure.
#include <unistd.h>
#include <stdio.h>
#include <glob.h>
int main( void )
{
glob_t paths;
int retval;
paths.gl_pathc = 0;
paths.gl_pathv = NULL;
paths.gl_offs = 0;
retval = glob( "/afc/trans/*.log",GLOB_NOCHECK | GLOB_NOSORT,
NULL, &paths );
if( retval == 0 ) {
int idx;
for( idx = 0; idx < paths.gl_pathc; idx++ ) {
printf( "[%d]: %s\n", idx,
paths.gl_pathv[idx] );
}
globfree( &paths );
} else {
puts( "glob() failed" );
}
return 0;
}
The printed result :
"[0]: /afc/trans/*.log "
The permission rights of /afc and /afc/trans is wrx, and it is same as that of the *.log files under /afc/trans .
I would be wery appreciated for your help.
Regards,
Shilunz