
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{1 \textcolor{comment}{//Compile with:}}
\DoxyCodeLine{2 \textcolor{comment}{// gcc -\/o eet-\/file eet-\/file.c `pkg-\/config -\/-\/cflags -\/-\/libs eet`}}
\DoxyCodeLine{3 }
\DoxyCodeLine{4 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{Eet_8h}{Eet.h}}>}}
\DoxyCodeLine{5 \textcolor{preprocessor}{\#include <stdio.h>}}
\DoxyCodeLine{6 \textcolor{preprocessor}{\#include <string.h>}}
\DoxyCodeLine{7 }
\DoxyCodeLine{8 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{9 create\_eet\_file(\textcolor{keywordtype}{void})}
\DoxyCodeLine{10 \{}
\DoxyCodeLine{11    \mbox{\hyperlink{group__Eet__File__Group_ga8d9779184a9870c1a225f1f40c76e8a7}{Eet\_File}} *ef;}
\DoxyCodeLine{12    \textcolor{keywordtype}{char} buf[1024], *ptr;}
\DoxyCodeLine{13    \textcolor{keywordtype}{int} size, len, i;}
\DoxyCodeLine{14    \textcolor{keyword}{const} \textcolor{keywordtype}{char} *some\_strings[] = \{}
\DoxyCodeLine{15       \textcolor{stringliteral}{"And some more strings"},}
\DoxyCodeLine{16       \textcolor{stringliteral}{"spread across several"},}
\DoxyCodeLine{17       \textcolor{stringliteral}{"elements of an array!"}}
\DoxyCodeLine{18    \};}
\DoxyCodeLine{19    \textcolor{keyword}{const} \textcolor{keywordtype}{char} some\_data[] =}
\DoxyCodeLine{20      \textcolor{stringliteral}{"\(\backslash\)x1e\(\backslash\)xe7\(\backslash\)x0f\(\backslash\)x42\(\backslash\)x00\(\backslash\)x00\(\backslash\)x00\(\backslash\)x01\(\backslash\)x00\(\backslash\)x00\(\backslash\)x00\(\backslash\)x00\(\backslash\)x00\(\backslash\)x00\(\backslash\)x00\(\backslash\)x35"}}
\DoxyCodeLine{21      \textcolor{stringliteral}{"\(\backslash\)x00\(\backslash\)x00\(\backslash\)x00\(\backslash\)xa0\(\backslash\)x00\(\backslash\)x00\(\backslash\)x00\(\backslash\)xa0\(\backslash\)x00\(\backslash\)x00\(\backslash\)x00\(\backslash\)x24\(\backslash\)x00\(\backslash\)x00\(\backslash\)x00\(\backslash\)x11"}}
\DoxyCodeLine{22      \textcolor{stringliteral}{"\(\backslash\)x00\(\backslash\)x00\(\backslash\)x00\(\backslash\)x00\(\backslash\)x2f\(\backslash\)x6d\(\backslash\)x69\(\backslash\)x73\(\backslash\)x74\(\backslash\)x65\(\backslash\)x72\(\backslash\)x69\(\backslash\)x6f\(\backslash\)x75\(\backslash\)x73\(\backslash\)x2f"}}
\DoxyCodeLine{23      \textcolor{stringliteral}{"\(\backslash\)x64\(\backslash\)x61\(\backslash\)x74\(\backslash\)x61\(\backslash\)x00\(\backslash\)x41\(\backslash\)x6e\(\backslash\)x20\(\backslash\)x45\(\backslash\)x45\(\backslash\)x54\(\backslash\)x20\(\backslash\)x69\(\backslash\)x6e\(\backslash\)x73\(\backslash\)x69"}}
\DoxyCodeLine{24      \textcolor{stringliteral}{"\(\backslash\)x64\(\backslash\)x65\(\backslash\)x20\(\backslash\)x6f\(\backslash\)x66\(\backslash\)x20\(\backslash\)x61\(\backslash\)x6e\(\backslash\)x20\(\backslash\)x45\(\backslash\)x45\(\backslash\)x54\(\backslash\)x21\(\backslash\)x0a\(\backslash\)x54\(\backslash\)x68"}}
\DoxyCodeLine{25      \textcolor{stringliteral}{"\(\backslash\)x69\(\backslash\)x73\(\backslash\)x20\(\backslash\)x77\(\backslash\)x61\(\backslash\)x73\(\backslash\)x6e\(\backslash\)x27\(\backslash\)x74\(\backslash\)x20\(\backslash\)x72\(\backslash\)x65\(\backslash\)x61\(\backslash\)x6c\(\backslash\)x6c\(\backslash\)x79"}}
\DoxyCodeLine{26      \textcolor{stringliteral}{"\(\backslash\)x20\(\backslash\)x75\(\backslash\)x73\(\backslash\)x65\(\backslash\)x66\(\backslash\)x75\(\backslash\)x6c\(\backslash\)x20\(\backslash\)x62\(\backslash\)x75\(\backslash\)x74\(\backslash\)x20\(\backslash\)x69\(\backslash\)x74\(\backslash\)x20\(\backslash\)x68"}}
\DoxyCodeLine{27      \textcolor{stringliteral}{"\(\backslash\)x65\(\backslash\)x6c\(\backslash\)x70\(\backslash\)x65\(\backslash\)x64\(\backslash\)x20\(\backslash\)x74\(\backslash\)x6f\(\backslash\)x20\(\backslash\)x73\(\backslash\)x68\(\backslash\)x6f\(\backslash\)x77\(\backslash\)x20\(\backslash\)x68\(\backslash\)x6f"}}
\DoxyCodeLine{28      \textcolor{stringliteral}{"\(\backslash\)x77\(\backslash\)x0a\(\backslash\)x74\(\backslash\)x6f\(\backslash\)x20\(\backslash\)x75\(\backslash\)x73\(\backslash\)x65\(\backslash\)x20\(\backslash\)x65\(\backslash\)x65\(\backslash\)x74\(\backslash\)x5f\(\backslash\)x6d\(\backslash\)x65\(\backslash\)x6d"}}
\DoxyCodeLine{29      \textcolor{stringliteral}{"\(\backslash\)x6f\(\backslash\)x70\(\backslash\)x65\(\backslash\)x6e\(\backslash\)x5f\(\backslash\)x72\(\backslash\)x65\(\backslash\)x61\(\backslash\)x64\(\backslash\)x28\(\backslash\)x29\(\backslash\)x20\(\backslash\)x74\(\backslash\)x6f\(\backslash\)x20\(\backslash\)x6f"}}
\DoxyCodeLine{30      \textcolor{stringliteral}{"\(\backslash\)x70\(\backslash\)x65\(\backslash\)x6e\(\backslash\)x20\(\backslash\)x61\(\backslash\)x6e\(\backslash\)x20\(\backslash\)x65\(\backslash\)x65\(\backslash\)x74\(\backslash\)x20\(\backslash\)x66\(\backslash\)x69\(\backslash\)x6c\(\backslash\)x65\(\backslash\)x20"}}
\DoxyCodeLine{31      \textcolor{stringliteral}{"\(\backslash\)x66\(\backslash\)x72\(\backslash\)x6f\(\backslash\)x6d\(\backslash\)x0a\(\backslash\)x64\(\backslash\)x61\(\backslash\)x74\(\backslash\)x61\(\backslash\)x20\(\backslash\)x61\(\backslash\)x6c\(\backslash\)x72\(\backslash\)x65\(\backslash\)x61\(\backslash\)x64"}}
\DoxyCodeLine{32      \textcolor{stringliteral}{"\(\backslash\)x79\(\backslash\)x20\(\backslash\)x6c\(\backslash\)x6f\(\backslash\)x61\(\backslash\)x64\(\backslash\)x65\(\backslash\)x64\(\backslash\)x20\(\backslash\)x69\(\backslash\)x6e\(\backslash\)x20\(\backslash\)x6d\(\backslash\)x65\(\backslash\)x6d\(\backslash\)x6f"}}
\DoxyCodeLine{33      \textcolor{stringliteral}{"\(\backslash\)x72\(\backslash\)x79\(\backslash\)x2e\(\backslash\)x0a\(\backslash\)x00"};}
\DoxyCodeLine{34 }
\DoxyCodeLine{35    ef = \mbox{\hyperlink{group__Eet__File__Group_ga5f55956b860aa2c77af9b1a880c4c256}{eet\_open}}(\textcolor{stringliteral}{"/tmp/my\_file.eet"}, \mbox{\hyperlink{group__Eet__File__Group_ggaa8e1a7af50fefaf15eb2f69543d24998a8f395f56fba48be007c65be51d799ee9}{EET\_FILE\_MODE\_WRITE}});}
\DoxyCodeLine{36    \textcolor{keywordflow}{if} (!ef) \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{37 }
\DoxyCodeLine{38    strcpy(buf, \textcolor{stringliteral}{"Here is a string of data to save!"});}
\DoxyCodeLine{39    size = \mbox{\hyperlink{group__Eet__File__Group_ga682d04715f0e11380c460814c4a9bd21}{eet\_write}}(ef, \textcolor{stringliteral}{"/key/to\_store/at"}, buf, \textcolor{keyword}{sizeof}(buf), 1);}
\DoxyCodeLine{40    \textcolor{keywordflow}{if} (!size)}
\DoxyCodeLine{41      \{}
\DoxyCodeLine{42         fprintf(stderr, \textcolor{stringliteral}{"Error writing data!\(\backslash\)n"});}
\DoxyCodeLine{43         \mbox{\hyperlink{group__Eet__File__Group_ga1675fef1f6012c1e02ae313d13dc3e03}{eet\_close}}(ef);}
\DoxyCodeLine{44         \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{45      \}}
\DoxyCodeLine{46    len = strlen(buf);}
\DoxyCodeLine{47    printf(\textcolor{stringliteral}{"strlen() = \%d, eet\_write() = \%d\(\backslash\)n"}, len, size);}
\DoxyCodeLine{48 }
\DoxyCodeLine{49    ptr = buf;}
\DoxyCodeLine{50    \textcolor{keywordflow}{for} (i = 0; i < 3; i++)}
\DoxyCodeLine{51      \{}
\DoxyCodeLine{52         len = strlen(some\_strings[i]) + 1;}
\DoxyCodeLine{53         memcpy(ptr, some\_strings[i], len);}
\DoxyCodeLine{54         ptr += len;}
\DoxyCodeLine{55      \}}
\DoxyCodeLine{56    \mbox{\hyperlink{group__Eet__File__Group_ga682d04715f0e11380c460814c4a9bd21}{eet\_write}}(ef, \textcolor{stringliteral}{"/several/strings"}, buf, \textcolor{keyword}{sizeof}(buf), 1);}
\DoxyCodeLine{57    \mbox{\hyperlink{group__Eet__File__Group_gaf343f344180955ed898aa86b90ebefda}{eet\_sync}}(ef);}
\DoxyCodeLine{58 }
\DoxyCodeLine{59    \mbox{\hyperlink{group__Eet__File__Group_ga682d04715f0e11380c460814c4a9bd21}{eet\_write}}(ef, \textcolor{stringliteral}{"/some/mysterious/data"}, some\_data, \textcolor{keyword}{sizeof}(some\_data) -\/ 1, 1);}
\DoxyCodeLine{60 }
\DoxyCodeLine{61    \mbox{\hyperlink{group__Eet__File__Group_gaa8a980d684123dfbaf12e7efefdb57f5}{eet\_delete}}(ef, \textcolor{stringliteral}{"/several/strings"});}
\DoxyCodeLine{62 }
\DoxyCodeLine{63    \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eet__File__Group_ga1675fef1f6012c1e02ae313d13dc3e03}{eet\_close}}(ef) == \mbox{\hyperlink{group__Eet__Group_ggaa9142d865094701672375485d4a6284da2e3af24c66d0decf7c97fe4e5a7f75d4}{EET\_ERROR\_NONE}};}
\DoxyCodeLine{64 \}}
\DoxyCodeLine{65 }
\DoxyCodeLine{66 \textcolor{keywordtype}{int}}
\DoxyCodeLine{67 main(\textcolor{keywordtype}{void})}
\DoxyCodeLine{68 \{}
\DoxyCodeLine{69    \mbox{\hyperlink{group__Eet__File__Group_ga8d9779184a9870c1a225f1f40c76e8a7}{Eet\_File}} *ef;}
\DoxyCodeLine{70    \textcolor{keywordtype}{char} *ret, **list;}
\DoxyCodeLine{71    \textcolor{keywordtype}{int} size, num, i;}
\DoxyCodeLine{72 }
\DoxyCodeLine{73    \mbox{\hyperlink{group__Eet__Group_ga9903687bfa20fe9a9e59d4c1d213e89a}{eet\_init}}();}
\DoxyCodeLine{74 }
\DoxyCodeLine{75    \textcolor{keywordflow}{if} (!create\_eet\_file())}
\DoxyCodeLine{76      \textcolor{keywordflow}{return} -\/1;}
\DoxyCodeLine{77 }
\DoxyCodeLine{78    ef = \mbox{\hyperlink{group__Eet__File__Group_ga5f55956b860aa2c77af9b1a880c4c256}{eet\_open}}(\textcolor{stringliteral}{"/tmp/my\_file.eet"}, \mbox{\hyperlink{group__Eet__File__Group_ggaa8e1a7af50fefaf15eb2f69543d24998a416f7e9a76b8131a44bbeedb13060c81}{EET\_FILE\_MODE\_READ}});}
\DoxyCodeLine{79    \textcolor{keywordflow}{if} (!ef) \textcolor{keywordflow}{return} -\/1;}
\DoxyCodeLine{80 }
\DoxyCodeLine{81    list = \mbox{\hyperlink{group__Eet__File__Group_ga6700a425f59086e7c8a945d6923874d3}{eet\_list}}(ef, \textcolor{stringliteral}{"*"}, \&num);}
\DoxyCodeLine{82    \textcolor{keywordflow}{if} (list)}
\DoxyCodeLine{83      \{}
\DoxyCodeLine{84         \textcolor{keywordflow}{for} (i = 0; i < num; i++)}
\DoxyCodeLine{85           printf(\textcolor{stringliteral}{"Key stored: \%s\(\backslash\)n"}, list[i]);}
\DoxyCodeLine{86         free(list);}
\DoxyCodeLine{87      \}}
\DoxyCodeLine{88 }
\DoxyCodeLine{89    ret = \mbox{\hyperlink{group__Eet__File__Group_gac13cdf7782d1e513f5b1abcc529962f4}{eet\_read}}(ef, \textcolor{stringliteral}{"/key/to\_store/at"}, \&size);}
\DoxyCodeLine{90    \textcolor{keywordflow}{if} (ret)}
\DoxyCodeLine{91      \{}
\DoxyCodeLine{92         printf(\textcolor{stringliteral}{"Data read (\%i bytes):\(\backslash\)n\%s\(\backslash\)n"}, size, ret);}
\DoxyCodeLine{93         free(ret);}
\DoxyCodeLine{94      \}}
\DoxyCodeLine{95 }
\DoxyCodeLine{96    ret = \mbox{\hyperlink{group__Eet__File__Group_gac13cdf7782d1e513f5b1abcc529962f4}{eet\_read}}(ef, \textcolor{stringliteral}{"/several/strings"}, \&size);}
\DoxyCodeLine{97    \textcolor{keywordflow}{if} (ret)}
\DoxyCodeLine{98      \{}
\DoxyCodeLine{99         printf(\textcolor{stringliteral}{"More data read (\%i bytes):\(\backslash\)n\%s\(\backslash\)n"}, size, ret);}
\DoxyCodeLine{100         free(ret);}
\DoxyCodeLine{101      \}}
\DoxyCodeLine{102 }
\DoxyCodeLine{103    ret = \mbox{\hyperlink{group__Eet__File__Group_gac13cdf7782d1e513f5b1abcc529962f4}{eet\_read}}(ef, \textcolor{stringliteral}{"/some/mysterious/data"}, \&size);}
\DoxyCodeLine{104    \textcolor{keywordflow}{if} (ret)}
\DoxyCodeLine{105      \{}
\DoxyCodeLine{106         \mbox{\hyperlink{group__Eet__File__Group_ga8d9779184a9870c1a225f1f40c76e8a7}{Eet\_File}} *ef2;}
\DoxyCodeLine{107 }
\DoxyCodeLine{108         ef2 = \mbox{\hyperlink{group__Eet__File__Group_gac514fa1812cfe27f0b7c0ff5fc13af45}{eet\_memopen\_read}}(ret, size);}
\DoxyCodeLine{109 }
\DoxyCodeLine{110         num = \mbox{\hyperlink{group__Eet__File__Group_ga53bf1cf96267787aa93a99a0fe7ba8f7}{eet\_num\_entries}}(ef2);}
\DoxyCodeLine{111         printf(\textcolor{stringliteral}{"Mysterious data has \%d entries\(\backslash\)n"}, num);}
\DoxyCodeLine{112 }
\DoxyCodeLine{113         printf(\textcolor{stringliteral}{"Mysterious data:\(\backslash\)n\%s\(\backslash\)n"},}
\DoxyCodeLine{114                (\textcolor{keywordtype}{char} *)\mbox{\hyperlink{group__Eet__File__Group_gacc64014ec7e2c5b148a5a63efcfecc6c}{eet\_read\_direct}}(ef2, \textcolor{stringliteral}{"/mysterious/data"}, NULL));}
\DoxyCodeLine{115 }
\DoxyCodeLine{116         \mbox{\hyperlink{group__Eet__File__Group_ga1675fef1f6012c1e02ae313d13dc3e03}{eet\_close}}(ef2);}
\DoxyCodeLine{117 }
\DoxyCodeLine{118         free(ret);}
\DoxyCodeLine{119      \}}
\DoxyCodeLine{120 }
\DoxyCodeLine{121    \mbox{\hyperlink{group__Eet__File__Group_ga1675fef1f6012c1e02ae313d13dc3e03}{eet\_close}}(ef);}
\DoxyCodeLine{122 }
\DoxyCodeLine{123    \mbox{\hyperlink{group__Eet__Group_gacbc7583179399d3b3e7b003e911f866f}{eet\_shutdown}}();}
\DoxyCodeLine{124 }
\DoxyCodeLine{125    \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{126 \}}
\DoxyCodeLine{127 }
\end{DoxyCodeInclude}
 