Tizen Native API  5.5

For brevity, variable declarations and initialization are omitted from this page, however the full source code can be seen here.

Here we have a simple callback to print the name of a file and the path that contains it:

static void
_print_cb(const char *name, const char *path, void *data EINA_UNUSED)
{
   printf("file %s in %s\n", name, path);
}

We can use this callback in the following call:

   eina_file_dir_list("/home/", EINA_FALSE, _print_cb, NULL);

The above is a way to print the files in a directory, but it is not the only one:

   it = eina_file_ls("/home/");
   EINA_ITERATOR_FOREACH(it, f_name)
     {
        printf("%s\n", f_name);
        eina_stringshare_del(f_name);
     }
   eina_iterator_free(it);

And now two ways to get more information than just file names:

   it = eina_file_stat_ls("/home/");
   EINA_ITERATOR_FOREACH(it, f_info)
     printf("%s if of type %d\n", f_info->path, f_info->type);
   eina_iterator_free(it);

   it = eina_file_direct_ls("/home/");
   EINA_ITERATOR_FOREACH(it, f_info)
     printf("%s if of type %d\n", f_info->path, f_info->type);
   eina_iterator_free(it);

The above mentioned ways of getting files on a list may produce the same output, but they have an important difference, eina_file_direct_ls() does not call stat, this means that on some systems it might not have file type information. On the other hand, it might be faster than eina_file_stat_ls().