\begin{DoxyDate}{Date}
2012 (created)
\end{DoxyDate}
\hypertarget{eio_main_eio_toc}{}\doxysection{Table of Contents}\label{eio_main_eio_toc}
\begin{DoxyItemize}
\item \mbox{\hyperlink{eio_main_eio_main_intro}{Introduction}} \item \mbox{\hyperlink{eio_main_eio_main_compiling}{How to compile}} \item \mbox{\hyperlink{eio_main_eio_main_next_steps}{Next Steps}} \item \mbox{\hyperlink{eio_main_eio_main_intro_example}{Introductory Example}}\end{DoxyItemize}
\hypertarget{eio_main_eio_main_intro}{}\doxysection{Introduction}\label{eio_main_eio_main_intro}
The Eio library is a library that implements an API for asynchronous input/output operation. Most operations are done in a separate thread to prevent lock. See \mbox{\hyperlink{group__Eio}{Eio}}. Some helper to work on data received in Eio callback are also provided see \mbox{\hyperlink{group__Eio__Helper}{Eio Reference helper API}}. It is also possible to work asynchronously on Eina\+\_\+\+File with \mbox{\hyperlink{group__Eio__Map}{Manipulate an Eina\+\_\+\+File asynchronously}} or on Eet\+\_\+\+File with \mbox{\hyperlink{group__Eio__Eet}{Eio asynchronous API for Eet file.}}. It comes with way to manipulate e\+Xtended attribute asynchronous with \mbox{\hyperlink{group__Eio__Xattr}{Eio manipulation of e\+Xtended attribute.}}.

This library is cross-\/platform and can be compiled and used on Linux, BSD, Opensolaris and Windows (XP and CE). It is heavily based on \mbox{\hyperlink{group__Ecore__Main__Loop__Group}{Ecore main loop}}.\hypertarget{eio_main_eio_main_compiling}{}\doxysection{How to compile}\label{eio_main_eio_main_compiling}
Eio is a library your application links to. The procedure for this is very simple. You simply have to compile your application with the appropriate compiler flags that the {\ttfamily pkg-\/config} script outputs. For example\+:

Compiling C or C++ files into object files\+:

\begin{DoxyVerb}gcc -c -o main.o main.c `pkg-config --cflags eio`
\end{DoxyVerb}


Linking object files into a binary executable\+:

\begin{DoxyVerb}gcc -o my_application main.o `pkg-config --libs eio`
\end{DoxyVerb}


See \mbox{\hyperlink{pkgconfig}{pkgconfig}}\hypertarget{eio_main_eio_main_next_steps}{}\doxysection{Next Steps}\label{eio_main_eio_main_next_steps}
After you understand what Eio is and installed it on your system you should proceed understand the programming interface.

Recommended reading\+:

\begin{DoxyItemize}
\item \mbox{\hyperlink{group__Eio__Helper}{Eio Reference helper API}} for common functions and library initialization. \item \mbox{\hyperlink{group__Eio__List}{Eio file listing API}} for listing files asynchronous. \item \mbox{\hyperlink{group__Eio__Management}{Eio file management API.}} for anyone who want to do a file manager (copy, rm, ...). \item \mbox{\hyperlink{group__Eio__Map}{Manipulate an Eina\+\_\+\+File asynchronously}} to manipulate files asynchronously (mmap). \item \mbox{\hyperlink{group__Eio__Xattr}{Eio manipulation of e\+Xtended attribute.}} to access file extended attributes (xattr). \item \mbox{\hyperlink{group__Eio__Monitor}{Eio file and directory monitoring API}} to monitor for file changes (inotify). \item \mbox{\hyperlink{group__Eio__Eet}{Eio asynchronous API for Eet file.}} to access Eet files asynchronously.\end{DoxyItemize}
\hypertarget{eio_main_eio_main_intro_example}{}\doxysection{Introductory Example}\label{eio_main_eio_main_intro_example}

\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{//Compile\ with:}}
\DoxyCodeLine{\textcolor{comment}{//gcc\ -\/o\ eio\_file\_ls\ eio\_file\_ls.c\ `pkg-\/config\ -\/-\/cflags\ -\/-\/libs\ ecore\ eio`}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <stdlib.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <stdio.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <string.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <Eio.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <Ecore.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_filter\_cb(\textcolor{keywordtype}{void}\ *data\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \mbox{\hyperlink{group__Eio_ga1145f009745ecb4d9f6a01a9bc5a9ac0}{Eio\_File}}\ *handler\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *file)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ *last\_slash\ =\ strrchr(file,\ \textcolor{charliteral}{'/'});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//Check\ if\ it\ is\ a\ hidden\ file}}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (last\_slash\ !=\ NULL\ \&\&\ strlen(last\_slash)\ >\ 1\ \&\&\ last\_slash[1]\ ==\ \textcolor{charliteral}{'.'})}
\DoxyCodeLine{\ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_main\_cb(\textcolor{keywordtype}{void}\ *data,\ \mbox{\hyperlink{group__Eio_ga1145f009745ecb4d9f6a01a9bc5a9ac0}{Eio\_File}}\ *handler\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *file)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{int}\ *number\_of\_listed\_files\ =\ (\textcolor{keywordtype}{int}\ *)data;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Processing\ file:\%s\(\backslash\)n"{}},\ file);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ (*number\_of\_listed\_files)++;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_done\_cb(\textcolor{keywordtype}{void}\ *data,\ \mbox{\hyperlink{group__Eio_ga1145f009745ecb4d9f6a01a9bc5a9ac0}{Eio\_File}}\ *handler\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{int}\ *number\_of\_listed\_files\ =\ (\textcolor{keywordtype}{int}\ *)data;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Number\ of\ listed\ files:\%d\(\backslash\)n"{}}\ \(\backslash\)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}ls\ operation\ is\ done,\ quitting.\(\backslash\)n"{}},\ *number\_of\_listed\_files);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}}();}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_error\_cb(\textcolor{keywordtype}{void}\ *data\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \mbox{\hyperlink{group__Eio_ga1145f009745ecb4d9f6a01a9bc5a9ac0}{Eio\_File}}\ *handler\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{int}\ error)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}Something\ has\ gone\ wrong:\%s\(\backslash\)n"{}},\ strerror(error));}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}}();}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}}
\DoxyCodeLine{main(\textcolor{keywordtype}{int}\ argc,\ \textcolor{keywordtype}{char}\ **argv)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{int}\ number\_of\_listed\_files\ =\ 0;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Init__Group_ga77757609684a2c922dc5ec398274751b}{ecore\_init}}();}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eio__Helper_ga557c198fc1a90518d7872b77843fa029}{eio\_init}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (argc\ <\ 2)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}You\ must\ pass\ a\ path\ to\ execute\ the\ command.\(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \ -\/1;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eio__List_ga4f2b3506617c59ed5df247d26b6b628f}{eio\_file\_ls}}(argv[1],\ \_filter\_cb,\ \_main\_cb,\ \_done\_cb,\ \_error\_cb,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \&number\_of\_listed\_files);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eio__Helper_ga7c3ad77c3f9a0346aab50f474af54b6c}{eio\_shutdown}}();}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Init__Group_ga768298b932f18d7e7593a447493e5cde}{ecore\_shutdown}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}


More examples can be found at \mbox{\hyperlink{eio_examples}{Eio Examples}}. 