\hypertarget{eet-basic_8c-example}{}\section{eet-\/basic.\+c}

\begin{DoxyCodeInclude}
\textcolor{comment}{//Compile with:}
\textcolor{comment}{// gcc -o eet-basic eet-basic.c `pkg-config --cflags --libs eet`}

\textcolor{preprocessor}{#include <\mbox{\hyperlink{Eet_8h}{Eet.h}}>}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{void})
\{
   \mbox{\hyperlink{group__Eet__File__Group_ga8d9779184a9870c1a225f1f40c76e8a7}{Eet\_File}} *ef;
   \textcolor{keywordtype}{char} *ret;
   \textcolor{keywordtype}{int} size;
   \textcolor{keywordtype}{char} *entries[] =
   \{
      \textcolor{stringliteral}{"Entry 1"},
      \textcolor{stringliteral}{"Big text string here compared to others"},
      \textcolor{stringliteral}{"Eet is cool"}
   \};

   \mbox{\hyperlink{group__Eet__Group_ga9903687bfa20fe9a9e59d4c1d213e89a}{eet\_init}}();

   \textcolor{comment}{// blindly open an file for output and write strings with their NUL char}
   ef = \mbox{\hyperlink{group__Eet__File__Group_ga5f55956b860aa2c77af9b1a880c4c256}{eet\_open}}(\textcolor{stringliteral}{"test.eet"}, \mbox{\hyperlink{group__Eet__File__Group_ggaa8e1a7af50fefaf15eb2f69543d24998a8f395f56fba48be007c65be51d799ee9}{EET\_FILE\_MODE\_WRITE}});
   \mbox{\hyperlink{group__Eet__File__Group_ga682d04715f0e11380c460814c4a9bd21}{eet\_write}}(ef, \textcolor{stringliteral}{"Entry 1"}, entries[0], strlen(entries[0]) + 1, 0);
   \mbox{\hyperlink{group__Eet__File__Group_ga682d04715f0e11380c460814c4a9bd21}{eet\_write}}(ef, \textcolor{stringliteral}{"Entry 2"}, entries[1], strlen(entries[1]) + 1, 1);
   \mbox{\hyperlink{group__Eet__File__Group_ga682d04715f0e11380c460814c4a9bd21}{eet\_write}}(ef, \textcolor{stringliteral}{"Entry 3"}, entries[2], strlen(entries[2]) + 1, 0);
   \mbox{\hyperlink{group__Eet__File__Group_ga1675fef1f6012c1e02ae313d13dc3e03}{eet\_close}}(ef);

   \textcolor{comment}{// open the file again and blindly get the entries we wrote}
   ef = \mbox{\hyperlink{group__Eet__File__Group_ga5f55956b860aa2c77af9b1a880c4c256}{eet\_open}}(\textcolor{stringliteral}{"test.eet"}, \mbox{\hyperlink{group__Eet__File__Group_ggaa8e1a7af50fefaf15eb2f69543d24998a416f7e9a76b8131a44bbeedb13060c81}{EET\_FILE\_MODE\_READ}});
   ret = \mbox{\hyperlink{group__Eet__File__Group_gac13cdf7782d1e513f5b1abcc529962f4}{eet\_read}}(ef, \textcolor{stringliteral}{"Entry 1"}, &size);
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, ret);
   free(ret);
   ret = \mbox{\hyperlink{group__Eet__File__Group_gac13cdf7782d1e513f5b1abcc529962f4}{eet\_read}}(ef, \textcolor{stringliteral}{"Entry 2"}, &size);
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, ret);
   free(ret);
   ret = \mbox{\hyperlink{group__Eet__File__Group_gac13cdf7782d1e513f5b1abcc529962f4}{eet\_read}}(ef, \textcolor{stringliteral}{"Entry 3"}, &size);
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, ret);
   free(ret);
   \mbox{\hyperlink{group__Eet__File__Group_ga1675fef1f6012c1e02ae313d13dc3e03}{eet\_close}}(ef);

   \mbox{\hyperlink{group__Eet__Group_gacbc7583179399d3b3e7b003e911f866f}{eet\_shutdown}}();
\}

\end{DoxyCodeInclude}
 