To use \hyperlink{Eio_8h_a0c22f9fa90963fa681a95268881e03dc}{eio\+\_\+file\+\_\+ls()}, you just need to define four callbacks\+:

\begin{DoxyItemize}
\item The filter callback, which allow or not a file to be seen by the main loop handler. This callback run in a separated thread. \item The main callback, which receive in the main loop all the file that are allowed by the filter. If you are updating a user interface it make sense to delay the insertion a little, so you get a chance to update the canvas for a bunch of file instead of one by one. \item The end callback, which is called in the main loop when the content of the directory has been correctly scanned and all the file notified to the main loop. \item The error callback, which is called if an error occured or if the listing was cancelled during it's run. You can then retrieve the error type as an errno error.\end{DoxyItemize}
Here is a simple example\+:


\begin{DoxyCode}
\textcolor{preprocessor}{#include <Ecore.h>}
\textcolor{preprocessor}{#include <\hyperlink{Eio_8h}{Eio.h}>}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_test\_filter\_cb(\textcolor{keywordtype}{void} *data, \hyperlink{Eio_8h_a1145f009745ecb4d9f6a01a9bc5a9ac0}{Eio\_File} *handler, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *file)
\{
   fprintf(stderr, \textcolor{stringliteral}{"ACCEPTING: %s\(\backslash\)n"}, file);
   \textcolor{keywordflow}{return} \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE};
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_test\_main\_cb(\textcolor{keywordtype}{void} *data, \hyperlink{Eio_8h_a1145f009745ecb4d9f6a01a9bc5a9ac0}{Eio\_File} *handler, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *file)
\{
   fprintf(stderr, \textcolor{stringliteral}{"PROCESS: %s\(\backslash\)n"}, file);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_test\_done\_cb(\textcolor{keywordtype}{void} *data, \hyperlink{Eio_8h_a1145f009745ecb4d9f6a01a9bc5a9ac0}{Eio\_File} *handler)
\{
   printf(\textcolor{stringliteral}{"ls done\(\backslash\)n"});
   \hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}();
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_test\_error\_cb(\textcolor{keywordtype}{void} *data, \hyperlink{Eio_8h_a1145f009745ecb4d9f6a01a9bc5a9ac0}{Eio\_File} *handler, \textcolor{keywordtype}{int} error)
\{
   fprintf(stderr, \textcolor{stringliteral}{"error: [%s]\(\backslash\)n"}, strerror(error));
   \hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}();
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{int} argc, \textcolor{keywordtype}{char} **argv)
\{
   \hyperlink{Eio_8h_a1145f009745ecb4d9f6a01a9bc5a9ac0}{Eio\_File} *cp;

   \textcolor{keywordflow}{if} (argc != 2)
     \{
        fprintf(stderr, \textcolor{stringliteral}{"eio\_ls directory\(\backslash\)n"});
        \textcolor{keywordflow}{return} -1;
     \}

   \hyperlink{group__Ecore__Init__Group_ga77757609684a2c922dc5ec398274751b}{ecore\_init}();
   \hyperlink{group__Eio__Helper_gac612fe5df9b9c93c275ee373745c2471}{eio\_init}();

   cp = \hyperlink{Eio_8h_a0c22f9fa90963fa681a95268881e03dc}{eio\_file\_ls}(argv[1],
                    \_test\_filter\_cb,
                    \_test\_main\_cb,
                    \_test\_done\_cb,
                    \_test\_error\_cb,
                    NULL);

   \hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}();

   \hyperlink{group__Eio__Helper_ga2281001078f6f99e3662bc889524831b}{eio\_shutdown}();
   \hyperlink{group__Ecore__Init__Group_ga768298b932f18d7e7593a447493e5cde}{ecore\_shutdown}();

   \textcolor{keywordflow}{return} 0;
\}
\end{DoxyCode}
 