hello,
i have take the code exemple on the documentation and i m just trying to
"concatene" a double to a string.
i have this
double val = 40.56;
char *s1 = " Mo";
and for the final i want this
40.56 MO
the code :
---------------------------------------------------------------------------------------------
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <Eina.h>
int main(void)
{
char tmp[128];
long long int m = 0;
long int e = 0;
double val = 40.56;
double r;
char *dst;
char *s1 = " Mo";
size_t l;
if (!eina_init())
{
printf ("Error during the initialization of eina.\n");
return EXIT_FAILURE;
}
printf("initial value : 40.56\n");
eina_convert_dtoa(val, tmp);//Convert a double to a string
printf("result dtoa : %s\n", tmp);
l = strlen(tmp) + 4 + 1;
dst = calloc(l, sizeof(char*)); // initiatilise le character à NULL,
evite les caractéres byzarre dans se char
eina_strlcat(dst, tmp, l); // add tmp to dst
eina_strlcat(dst, s1, l); // add s1 to dst
printf("DST = %s\n",dst);
eina_shutdown();
return EXIT_SUCCESS;
}
---------------------------------------------------------------------------------------------
the résult :
---------------------------------------------------------------------------------------------
i...@issa-desktop:/media/Element/programmation/EFL/program/Convertion_Eina/bin$
./main
initial value : 40.56
result dtoa : 0x1.447ae147ae148p+5
DST = 0x1.447ae147ae148p+5 Mo
---------------------------------------------------------------------------------------------
So i think if i succes to make this here, i can make it on my function.
do u think i m on the good road or it's not the good solution ?
thanks
Le mardi 10 août 2010 à 10:43 +0200, Cedric BAIL a écrit :
> Hi,
>
> On Tue, Aug 10, 2010 at 10:20 AM, Issa <[email protected]> wrote:
> > i have problem to use Eina convert function, i think im not understand
> > how that's work.
> > if someone can explain me please.
> >
> > so i have a function to make my convertion, but all the time the
> > convertion failed, but i can't see why.
> > maybe some on can explian what i m doing wrong, please ?
>
> eina_convert_dtoa and eina_convert_atod are only supposed to work
> together and be portable where ever you go. The string you are giving
> to eina_convert_atod should come from eina_convert_dtoa.
>
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel