gfal_testdir.c

This exemple 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

#include <stdio.h>
#include <stdlib.h>
#include "gfal_api.h"

main(int argc, char **argv)
{
        struct dirent *d;
        DIR *dir;

        if (argc != 2) {
                fprintf (stderr, "usage: %s filename\n", argv[0]);
                exit (1);
        }

        if ((dir = gfal_opendir (argv[1])) == NULL) {
                perror ("gfal_opendir");
                exit (1);
        }


        while ((d = gfal_readdir (dir))) {
                printf ("%s\n", d->d_name);
        }

        if (gfal_closedir (dir) < 0) {
                perror ("gfal_closedir");
                exit (1);
        }
        exit (0);
}

Generated on 7 Mar 2013 for CERN GFAL 2.0 by  doxygen 1.6.1