\hypertarget{eina_stringshare_01_8c-example}{}\section{eina\+\_\+stringshare\+\_\+01.\+c}

\begin{DoxyCodeInclude}
\textcolor{comment}{//Compile with:}
\textcolor{comment}{//gcc -g eina\_stringshare\_01.c -o eina\_stringshare\_01 `pkg-config --cflags --libs eina`}

\textcolor{preprocessor}{#include <stdio.h>}
\textcolor{preprocessor}{#include <\mbox{\hyperlink{Eina_8h}{Eina.h}}>}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{int} argc \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \textcolor{keywordtype}{char} **argv \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})
\{
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *str, *str2;
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *prologe = \textcolor{stringliteral}{"The Cylons were created by man. They rebelled. They "}
                         \textcolor{stringliteral}{"evolved."};
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *prologe2 = \textcolor{stringliteral}{"%d Cylon models. %d are known. %d live in secret. "}
                          \textcolor{stringliteral}{"%d will be revealed."};
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *prologe3 = \textcolor{stringliteral}{"There are many copies. And they have a plan."};

   \mbox{\hyperlink{group__Eina__Main__Group_gabf448ada5bc81a07342b66c6f818ee5e}{eina\_init}}();

   str = \mbox{\hyperlink{group__Eina__Stringshare__Group_gabe8ecf4121011cb792f36ecd8c44e470}{eina\_stringshare\_add\_length}}(prologe, 31);
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, str);
   printf(\textcolor{stringliteral}{"length: %d\(\backslash\)n"}, \mbox{\hyperlink{group__Eina__Stringshare__Group_gaf316a9f4a787091ee437ec7caf0a5c7b}{eina\_stringshare\_strlen}}(str));
   \mbox{\hyperlink{group__Eina__Stringshare__Group_ga495411b0bc85b9c0d59ec7255a025260}{eina\_stringshare\_del}}(str);

   str = \mbox{\hyperlink{group__Eina__Stringshare__Group_gab3507a1373455cac57bf494e776fe4a8}{eina\_stringshare\_printf}}(prologe2, 12, 7, 4, 1);
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, str);
   \mbox{\hyperlink{group__Eina__Stringshare__Group_ga495411b0bc85b9c0d59ec7255a025260}{eina\_stringshare\_del}}(str);

   str = \mbox{\hyperlink{group__Eina__Stringshare__Group_ga4bc3769aa8d4d33c36b6857af33a810b}{eina\_stringshare\_nprintf}}(45, \textcolor{stringliteral}{"%s"}, prologe3);
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, str);
   str2 = \mbox{\hyperlink{group__Eina__Stringshare__Group_ga5293082680141132ffcacc28866ef0ef}{eina\_stringshare\_add}}(prologe3);
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, str2);
   \mbox{\hyperlink{group__Eina__Stringshare__Group_gac6f45e4273f13f42e9a3c48435cd03dc}{eina\_stringshare\_ref}}(str2);
   \mbox{\hyperlink{group__Eina__Stringshare__Group_ga495411b0bc85b9c0d59ec7255a025260}{eina\_stringshare\_del}}(str2);
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, str2);

   eina\_stringshare\_replace(&str, prologe);
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, str);

   \mbox{\hyperlink{group__Eina__Stringshare__Group_ga495411b0bc85b9c0d59ec7255a025260}{eina\_stringshare\_del}}(str);
   \mbox{\hyperlink{group__Eina__Stringshare__Group_ga495411b0bc85b9c0d59ec7255a025260}{eina\_stringshare\_del}}(str2);

   \mbox{\hyperlink{group__Eina__Main__Group_ga6741fcaba116e31e96ce14dcfa03f568}{eina\_shutdown}}();

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