Hello, 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 ? My code : ------------------------------------------------------------------------------------------------------------------------------------------------ #include <stdlib.h> #include <stdio.h> #include <math.h> #include <Eina.h> double convert_string_double(const char *tmp) { long long int m = 0; long int e = 0; double r; //int taille_string = strlen(tmp); if (!eina_init()) { printf("Error during the initialization of eina.\n"); return EXIT_FAILURE; } printf("value string : %s\n", tmp); //convert string to double if (eina_convert_atod(tmp, strlen(tmp), &m, &e)) printf("Convertion Sucess \n"); else printf("Convertion Failed \n"); r = ldexp((double) m, e); //printf("value double: %f\n", r); eina_shutdown(); return r; } char *convert_string_kb_to_mo(char *data) { char *tmp = {0}; double t = 0; //converti en MO printf("DATA = %s\n", data); t = atof(data) / 1000; printf("T = %f\n", t); if (!eina_init()) { printf("Error during the initialization of eina.\n"); // return EXIT_FAILURE; } //convert string to double if (eina_convert_dtoa(t, tmp)) printf("Convertion Sucess \n"); else printf("Convertion Ratée \n"); return tmp; } int main(void) { char *tmp = "12.5G"; char *tmp2 = "2061672"; char *tmp_final; double r = 0; r = convert_string_double(tmp); tmp_final = convert_string_kb_to_mo(tmp2); printf("r = %f\n", r); printf("tmp_final = %s\n", tmp_final); eina_shutdown(); return EXIT_SUCCESS; } ------------------------------------------------------------------------------------------------------------------------------------------------ The résult : ------------------------------------------------------------------------------------------------------------------------------------------------ i...@issa-desktop:/media/Element/programmation/EFL/program/Convertion_Eina/bin$ ./main value string : 12.5G Convertion Failed DATA = 2061672 T = 2061.672000 ERR: eina_convert.c:528 eina_convert_dtoa() safety check failed: des == NULL Convertion Ratée r = 0.000000 tmp_final = (null) ------------------------------------------------------------------------------------------------------------------------------------------------ Thanks ------------------------------------------------------------------------------ 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 enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel