gfal_testdir.c

This example show how to list the files in a directory ex : use case with SRM plugin : ./gfal_testdir srm://grid05.lal.in2p3.fr:8446/dpm/lal.in2p3.fr/home/dteam/test_r2d2

00001 
00005 #include <stdio.h>
00006 #include <stdlib.h>
00007 #include "gfal_api.h"
00008 #include "gfal_posix_internal.h"
00009 
00010 int main(int argc, char **argv)
00011 {
00012         struct dirent *d;
00013         DIR *dir;
00014 
00015         if (argc != 2) {
00016                 fprintf (stderr, "usage: %s filename\n", argv[0]);
00017         return 1;
00018         }
00019 
00020         gfal_set_verbose(10);
00021 
00022         if ((dir = gfal_opendir (argv[1])) == NULL) {
00023                 perror ("gfal_opendir");
00024                 fprintf(stderr, "%s\n", (*gfal_posix_get_last_error())->message);
00025         return 1;
00026         }
00027 
00028     
00029         while ((d = gfal_readdir (dir))) {
00030                 printf ("%s\n", d->d_name);
00031         }
00032 
00033         if (gfal_closedir (dir) < 0) {
00034                 perror ("gfal_closedir");
00035         return 1;
00036         }
00037     return 0;
00038 }

Generated on 13 Mar 2014 for GFAL2 by  doxygen 1.4.7